Skip to content

Keep local interactions responsive#6204

Closed
ComputelessComputer wants to merge 1 commit into
fix/share-note-loadingfrom
fix/local-first-interactions
Closed

Keep local interactions responsive#6204
ComputelessComputer wants to merge 1 commit into
fix/share-note-loadingfrom
fix/local-first-interactions

Conversation

@ComputelessComputer

@ComputelessComputer ComputelessComputer commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Cancel dismissible sharing work, keep calendar network activity out of the local write queue, and scope persistence flushes.


This is part 2 of 2 in a stack made with GitButler:


Note

Medium Risk
Touches calendar sync invalidation on disconnect and sharing abort semantics; incorrect generation or flush scoping could cause stale reads or skipped writes, but changes are well covered by new tests.

Overview
Improves desktop responsiveness by not blocking the local DB write queue on slow network work, flushing only relevant write keys before reads, and letting users dismiss in-flight share preparation.

Database write queue adds flushDatabaseWritesByPrefix and flushDatabaseWritesWithin (5s timeout on exit/relaunch) so lifecycle and cache maintenance do not wait on unrelated pending writes.

Calendar sync serializes runs in an in-memory enqueueCalendarSync tail instead of holding the calendar-sync queue key for the whole fetch; persistence stays on calendar-sync for inventory and connection snapshots. Disconnect bumps a generation and filters stale connections so late discovery cannot restore removed accounts.

Session sharing tracks active preparation identity, aborts on popover close/account/note switch, and treats ShareOperationAbortedError as silent in mutation toasts; the loading popover can close via Escape/Done without blocking on pending work. Sync-state loads pass sessionId and flush only that session plus the viewer’s shared-note cache.

Shared-note / attachment cache paths flush targeted keys (e.g. session:{id}, shared-note-cache:{viewer}) instead of draining the full queue.

Reviewed by Cursor Bugbot for commit 79db40e. Bugbot is set up for automated code reviews on this repo. Configure here.

Comment thread apps/desktop/src/session-sharing/index.tsx
Comment thread apps/desktop/src/session-sharing/attachments.ts Outdated
@ComputelessComputer
ComputelessComputer force-pushed the fix/local-first-interactions branch from ea55cc5 to e16a8b0 Compare July 22, 2026 07:32
Comment thread apps/desktop/src/session-sharing/index.tsx
Comment thread apps/desktop/src/session-sharing/index.tsx
@ComputelessComputer
ComputelessComputer force-pushed the fix/local-first-interactions branch from e16a8b0 to 92780aa Compare July 22, 2026 07:36
Comment thread apps/desktop/src/services/calendar/index.ts
@ComputelessComputer
ComputelessComputer force-pushed the fix/local-first-interactions branch from 92780aa to 540705e Compare July 22, 2026 07:41
Cancel dismissible sharing work, keep calendar network activity out of the local write queue, and scope persistence flushes.
@ComputelessComputer
ComputelessComputer force-pushed the fix/local-first-interactions branch from 540705e to 79db40e Compare July 22, 2026 07:44

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 79db40e. Configure here.

discoveredConnections,
);

await syncCalendars(providerConnections, options.signal);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disconnect aborts all calendar syncs

Medium Severity

removeDisconnectedCalendarConnection bumps calendarSyncGeneration, which makes isStopped true for every in-flight sync, including unrelated connections. The disconnect deeplink path only tombstones and does not schedule a follow-up sync, so remaining calendars can stay unsynced until some later unrelated trigger.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 79db40e. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant