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

90.9% Statements 10/11
100% Branches 4/4
100% Functions 1/1
80% Lines 4/5

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 18 19 20 21 22                1048x         1048x 1018x       3280x      
import { Fragment, type ReactNode } from "react";
import { useSearchParams } from "react-router-dom";
import {
  getRevisionReadIdentity,
  getRevisionRouteScopeFromUrl,
} from "@/api/flowsheetRevisionScope";
 
/** Remount state-reading hooks whenever the selected immutable read state changes. */
export function FlowsheetReadStateBoundary({
  children,
}: {
  children: ReactNode;
}) {
  const [searchParams] = useSearchParams();
  const revisionScope = getRevisionRouteScopeFromUrl(
    `?${searchParams.toString()}`,
  );
  return (
    <Fragment key={getRevisionReadIdentity(revisionScope)}>{children}</Fragment>
  );
}