Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(meeting-notes): sidebar can be expanded again during a focused meeting

Louis Beaumont205bf128f6f7
diff --git a/apps/screenpipe-app-tauri/app/home/page.tsx b/apps/screenpipe-app-tauri/app/home/page.tsx
index fc836c428..a3055f624 100644
--- a/apps/screenpipe-app-tauri/app/home/page.tsx
+++ b/apps/screenpipe-app-tauri/app/home/page.tsx
@@ -196,12 +196,23 @@ function HomeContent() {
// Ephemeral collapse for focused workflows (e.g. taking notes during
// a meeting). Captures the user's prior sidebar state on enter and
// restores it on exit — never persisted to localStorage.
+ //
+ // Stable identity (no deps) so this callback doesn't re-fire the
+ // child's notify-effect every time `sidebarCollapsed` flips. The prior
+ // version had `[sidebarCollapsed]` in its deps, which meant: user
+ // hits Cmd+B in focused-meeting mode → setSidebarCollapsed(false) →
+ // callback recreated → child's "notify on selectedId/onFocusModeChange"
+ // effect re-ran with selectedId still set → setSidebarCollapsed(true).
+ // Net effect: the sidebar slammed shut every time the user tried to
+ // open it during a meeting.
const sidebarPrevCollapsedRef = useRef<boolean | null>(null);
+ const sidebarCollapsedRef = useRef(sidebarCollapsed);
+ useEffect(() => { sidebarCollapsedRef.current = sidebarCollapsed; }, [sidebarCollapsed]);
const handleMeetingFocusModeChange = useCallback(
(focused: boolean) => {
if (focused) {
if (sidebarPrevCollapsedRef.current === null) {
- sidebarPrevCollapsedRef.current = sidebarCollapsed;
+ sidebarPrevCollapsedRef.current = sidebarCollapsedRef.current;
}
setSidebarCollapsed(true);
} else if (sidebarPrevCollapsedRef.current !== null) {
@@ -210,7 +221,7 @@ function HomeContent() {
setSidebarCollapsed(prev);
}
},
- [sidebarCollapsed],
+ [],
);
// Cmd+B / Ctrl+B to toggle sidebar
diff --git a/apps/screenpipe-app-tauri/components/meeting-notes/index.tsx b/apps/screenpipe-app-tauri/components/meeting-notes/index.tsx
index 6ea0505cf..0d811b53a 100644
--- a/apps/screenpipe-app-tauri/components/meeting-notes/index.tsx
+++ b/apps/screenpipe-app-tauri/components/meeting-notes/index.tsx
@@ -139,16 +139,24 @@ export function MeetingNotesSection({
}, [meetingState.activeMeetingId, fetchPage]);
// Notify host of focus-mode transitions so it can collapse the sidebar.
+ // Only fire on the actual selection edge — depending on
+ // `onFocusModeChange` re-fires this whenever the host's callback
+ // identity changes (e.g. after the user expands the sidebar by hand,
+ // which is exactly the wrong moment to re-collapse it).
+ const onFocusModeChangeRef = useRef(onFocusModeChange);
useEffect(() => {
- onFocusModeChange?.(selectedId !== null);
- }, [selectedId, onFocusModeChange]);
+ onFocusModeChangeRef.current = onFocusModeChange;
+ }, [onFocusModeChange]);
+ useEffect(() => {
+ onFocusModeChangeRef.current?.(selectedId !== null);
+ }, [selectedId]);
// Ensure we exit focus mode if the user navigates away entirely.
useEffect(() => {
return () => {
- onFocusModeChange?.(false);
+ onFocusModeChangeRef.current?.(false);
};
- }, [onFocusModeChange]);
+ }, []);
// If selection vanishes (deleted elsewhere), drop selection
useEffect(() => {