mishig HF Staff commited on
Commit
c399e5f
·
verified ·
1 Parent(s): e570a2c

Sync from GitHub via hub-sync

Browse files
src/app/[org]/[dataset]/[episode]/episode-viewer.tsx CHANGED
@@ -289,16 +289,14 @@ function EpisodeViewerInner({
289
  setSidebarFlaggedOnly(true);
290
  }, []);
291
 
292
- // Persist UI state across episode navigations
 
 
293
  useEffect(() => {
294
  sessionStorage.setItem("activeTab", activeTab);
295
- }, [activeTab]);
296
- useEffect(() => {
297
  sessionStorage.setItem("sidebarFlaggedOnly", String(sidebarFlaggedOnly));
298
- }, [sidebarFlaggedOnly]);
299
- useEffect(() => {
300
  sessionStorage.setItem("framesFlaggedOnly", String(framesFlaggedOnly));
301
- }, [framesFlaggedOnly]);
302
 
303
  const loadStats = () => {
304
  if (statsLoadedRef.current) return;
 
289
  setSidebarFlaggedOnly(true);
290
  }, []);
291
 
292
+ // Persist UI state across episode navigations. One effect instead of
293
+ // three near-identical writes — fewer commit hooks per render and the
294
+ // intent (mirror three primitives to sessionStorage) reads as one unit.
295
  useEffect(() => {
296
  sessionStorage.setItem("activeTab", activeTab);
 
 
297
  sessionStorage.setItem("sidebarFlaggedOnly", String(sidebarFlaggedOnly));
 
 
298
  sessionStorage.setItem("framesFlaggedOnly", String(framesFlaggedOnly));
299
+ }, [activeTab, sidebarFlaggedOnly, framesFlaggedOnly]);
300
 
301
  const loadStats = () => {
302
  if (statsLoadedRef.current) return;