persistSession function ✓ 100.0%

Last updated: 2026-03-05T11:49:57.418Z

Metrics

LOC: 12 Complexity: 3 Params: 0 Coverage: 100.0% (3/3 lines, 0x executed)

Signature

persistSession(): : void

Summary

Serializes the current session and captured responses to sessionStorage. Called before page navigation (beforeunload / form submit) to survive reloads.

Source Code

function persistSession(): void {
  if (!session) return;
  try {
    const data: PersistedRecording = {
      session: { ...session, steps: [...session.steps] },
      capturedResponses: [...capturedResponses],
    };
    sessionStorage.setItem(RECORDING_SESSION_KEY, JSON.stringify(data));
  } catch {
    // sessionStorage may be unavailable in sandboxed iframes — ignore silently
  }
}

No outgoing dependencies.

Impact (Incoming)

graph LR persistSession["persistSession"] onSubmit["onSubmit"] onBeforeUnload["onBeforeUnload"] onSubmit -->|calls| persistSession onBeforeUnload -->|calls| persistSession style persistSession fill:#dbeafe,stroke:#2563eb,stroke-width:2px click persistSession "6165c1b3efca0f90.html" click onSubmit "8be45aca6a1f4353.html" click onBeforeUnload "909c46d7298d3043.html"
SourceType
onSubmit calls
onBeforeUnload calls