-
Notifications
You must be signed in to change notification settings - Fork 537
Description
Problem
When a summary is being generated but the session tab is not in view (user switched to another tab), the summary may fail to save properly.
Root Cause Analysis
The useAutoEnhance hook (and its sub-hooks useListenerStopTrigger and useAutoEnhanceRunner) only run when the session tab component is rendered. Since only the active tab's content is rendered, switching tabs unmounts these hooks.
Scenario:
- User starts recording on Session A
- User switches to Session B tab (Session A's
useAutoEnhanceis now unmounted) - Recording stops
useListenerStopTriggerin Session A is not running, so it never detects the stop- Auto-enhancement never triggers for Session A
Related Work
PR #3581 fixed two different bugs in the auto-enhance logic:
- Task never starting: The
enhanceTaskIdwas computed at render time from a null ref - Infinite loop: The
usePrevioushook caused timing issues triggering enhancement repeatedly
These fixes addressed issues when the tab IS in view. The "not in view" scenario is a separate issue.
Potential Solutions
-
Global listener approach: Move the auto-enhance trigger logic to a global hook that runs at the app layout level, independent of which tab is active. This ensures enhancement is triggered based on session lifecycle rather than component lifecycle.
-
Background task queue: When recording stops, queue the enhancement task in a global store that persists regardless of tab state.
-
Persist trigger state: Store the "needs enhancement" flag in the session data itself, and check for pending enhancements when a tab becomes active.
Notes
- The current modular structure from PR Fix and refactor auto-enhance logic #3581 (
eligibility.ts,runner.ts,trigger.ts) provides a good foundation for implementing a fix - Any solution should avoid duplicate enhancement triggers
- The fix should work for multiple concurrent sessions
Metadata
Metadata
Assignees
Labels
Type
Projects
Status