All files / src/pages/flowsheet-page/flowsheet/revisions FlowsheetRevisionPreviewGate.tsx

77.77% Statements 7/9
60% Branches 3/5
100% Functions 1/1
71.42% Lines 5/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17          1030x 1030x     8x   10x   1020x      
import type { PropsWithChildren } from "react";
import { useFlowsheetRevisionPreview } from "@/hooks/flowsheetRevisionPreview";
import FlowsheetCanvasLoadingOverlay from "../Canvas/FlowsheetCanvasLoadingOverlay";
 
/** Withhold state-owned readers until deep-link revision metadata is valid. */
export function FlowsheetRevisionPreviewGate({ children }: PropsWithChildren) {
  const { isPreview, isLoading } = useFlowsheetRevisionPreview();
  if (isPreview && isLoading) {
    return (
      <div className="relative flex-1 overflow-hidden">
        <FlowsheetCanvasLoadingOverlay />
      </div>
    );
  }
  return children;
}