All files / src/features/sorting ResumeOnLoad.tsx

100% Statements 5/5
100% Branches 0/0
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 13 14 152x                 2x 2x   2x    
"use client";
 
import { useEffect } from "react";
import { patchSessionStatus } from "./sessionStatusPatch";
 
// A paused sort opened by URL (or a stale tab) reads "paused" everywhere else, so
// it is tidied back to active on mount — never during the server render, where a
// link prefetch would un-pause it. Best-effort: answers land on a paused sort too.
export function ResumeOnLoad({ curatorId, sessionId }: { curatorId: string; sessionId: string }) {
  useEffect(() => {
    patchSessionStatus({ curatorId, sessionId }, "active").catch(() => undefined);
  }, [curatorId, sessionId]);
  return null;
}