All files / src/pages/flowsheet-page/menuBar SyncIndicator.tsx

100% Statements 5/5
100% Branches 2/2
100% Functions 3/3
100% Lines 4/4

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          37x 12562x     5124x 5124x  
import { useSelector } from "react-redux";
import { RootState } from "@/store/store";
import { CircleCheck } from "lucide-react";
import { Spinner } from "../../../ahuora-design-system/ui/spinner";
 
const selectAnyMutationInProgress = (state:RootState) =>
  Object.values(state.api.mutations).some((m) => m.status === "pending");
 
export function SyncIndicator() {
  const anyPending = useSelector(selectAnyMutationInProgress);
  return anyPending ? <div aria-label="Syncing Flowsheet"><Spinner></Spinner></div> : <div aria-label="Flowsheet Synced"></div>;
}