diff --git a/src/Components/Facility/ConsultationDetails/ConsultationFeedTab.tsx b/src/Components/Facility/ConsultationDetails/ConsultationFeedTab.tsx index f7d81a56edf..c1095d06e5a 100644 --- a/src/Components/Facility/ConsultationDetails/ConsultationFeedTab.tsx +++ b/src/Components/Facility/ConsultationDetails/ConsultationFeedTab.tsx @@ -27,7 +27,7 @@ export const ConsultationFeedTab = (props: ConsultationTabProps) => { const authUser = useAuthUser(); const facility = useSlug("facility"); const bed = props.consultationData.current_bed?.bed_object; - const feedStateSessionKey = getFeedStateKey(props.consultationId); + const feedStateSessionKey = `encounterFeedState[${props.consultationId}]`; const [asset, setAsset] = useState(); const [preset, setPreset] = useState(); @@ -126,17 +126,16 @@ export const ConsultationFeedTab = (props: ConsultationTabProps) => { }, [!!bed, loading, !!asset, divRef.current]); useEffect(() => { - const feedPresetKey = getFeedStateKey(props.consultationId); if (preset?.id) { sessionStorage.setItem( - feedPresetKey, + feedStateSessionKey, JSON.stringify({ type: "preset", value: preset.id, } satisfies LastAccessedPreset), ); } - }, [preset, props.consultationId]); + }, [feedStateSessionKey, preset]); if (loading) { return ; @@ -271,7 +270,3 @@ type LastAccessedPosition = { }; type LastFeedState = LastAccessedPosition | LastAccessedPreset; - -const getFeedStateKey = (consultationId: string) => { - return `encounterFeedState[${consultationId}]`; -};