"use client"; import { useEffect, useId, useState } from "react"; const _storageKey = (id: string) => `er-incident-notes:${id}`; export function IncidentNotes({ incidentId }: { incidentId: string }) { const _id = useId(); const [value, setValue] = useState(""); useEffect(() => { if (typeof window === "undefined") { return; } const _stored = window.sessionStorage.getItem(_storageKey(incidentId)); setValue(_stored ?? ""); }, [incidentId]); useEffect(() => { if (typeof window === "undefined") { return; } window.sessionStorage.setItem(_storageKey(incidentId), value); }, [incidentId, value]); return (