Skip to content

Keep local interactions responsive#6205

Merged
ComputelessComputer merged 1 commit into
mainfrom
fix/local-first-interactions
Jul 22, 2026
Merged

Keep local interactions responsive#6205
ComputelessComputer merged 1 commit into
mainfrom
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.

Supersedes #6204, which GitHub automatically closed when its stacked base #6202 merged and was deleted.


Note

Medium Risk
Touches calendar disconnect invalidation, global write-queue flush semantics, and sharing lifecycle—areas where races could affect data consistency, though behavior is heavily test-covered.

Overview
Improves local responsiveness by narrowing when the app waits on SQLite writes, moving slow calendar work off the write queue, and making session sharing dismissible without stray side effects.

Database write queue — Keyed flushDatabaseWrites now loops until targeted keys are idle (including writes enqueued mid-flush) and still surfaces the first failure after draining. Adds flushDatabaseWritesByPrefix and flushDatabaseWritesWithin (timeout without abandoning in-flight writes). Call sites flush only relevant keys (e.g. session:{id}, attachment-transfers, shared-note-cache:{viewer}) instead of the whole queue. Exit/relaunch use a 5s bounded flush with Promise.allSettled so settings save can finish even if the DB flush times out.

Calendar sync — Full sync runs on a separate enqueueCalendarSync chain; only inventory/event commits use enqueueDatabaseWrite("calendar-sync", …). Generation and a disconnected-connection set invalidate in-flight work so disconnect/reconnect cannot restore stale data; tombstone failures roll back the disconnect marker. Deeplink handler triggers syncCalendarEvents after disconnect and allowReconnectedCalendarConnections on reconnect.

Session sharing — Share popover can close anytime; preparation uses attempt IDs and abort controllers so dismissed work does not publish or show errors. ShareOperationAbortedError suppresses toasts on cancel; invitation rollback respects abort. General access scope UI is restrict-only (link/workspace scope flows removed). Sync state loads after scoped flushes including sessionId.

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

@netlify

netlify Bot commented Jul 22, 2026

Copy link
Copy Markdown

Deploy Preview for old-char canceled.

Name Link
🔨 Latest commit fd4e5b6
🔍 Latest deploy log https://app.netlify.com/projects/old-char/deploys/6a609ad444804b0008c89b03

Comment thread apps/desktop/src/session-sharing/index.tsx Outdated
Comment thread apps/desktop/src/services/calendar/index.ts Outdated
@ComputelessComputer
ComputelessComputer force-pushed the fix/local-first-interactions branch from e18bfc4 to 0009412 Compare July 22, 2026 08:11
Comment thread apps/desktop/src/shared/relaunch.ts
Comment thread apps/desktop/src/db/write-queue.ts
@ComputelessComputer
ComputelessComputer force-pushed the fix/local-first-interactions branch from 0009412 to 41f9f9a Compare July 22, 2026 08:34
Comment thread apps/desktop/src/services/calendar/index.ts Outdated
@ComputelessComputer
ComputelessComputer force-pushed the fix/local-first-interactions branch from 41f9f9a to bb675e4 Compare July 22, 2026 09:04
Comment thread apps/desktop/src/services/calendar/index.ts
@ComputelessComputer
ComputelessComputer force-pushed the fix/local-first-interactions branch from bb675e4 to b78cebf Compare July 22, 2026 09:11
Comment thread apps/desktop/src/session-sharing/index.tsx
@ComputelessComputer
ComputelessComputer force-pushed the fix/local-first-interactions branch from b78cebf to 68bc654 Compare July 22, 2026 09:20
Comment thread apps/desktop/src/shared/app-exit.ts
@ComputelessComputer
ComputelessComputer force-pushed the fix/local-first-interactions branch from 68bc654 to e9b9e18 Compare July 22, 2026 09:27
Comment thread apps/desktop/src/services/calendar/index.ts
@ComputelessComputer
ComputelessComputer force-pushed the fix/local-first-interactions branch from e9b9e18 to aace19a Compare July 22, 2026 09:34
Comment thread apps/desktop/src/session-sharing/index.tsx
@ComputelessComputer
ComputelessComputer force-pushed the fix/local-first-interactions branch from aace19a to a478641 Compare July 22, 2026 09:41
Comment thread apps/desktop/src/services/calendar/index.ts Outdated
@ComputelessComputer
ComputelessComputer force-pushed the fix/local-first-interactions branch from a478641 to 9b2f53a Compare July 22, 2026 09:53
Comment thread apps/desktop/src/services/calendar/index.ts
@ComputelessComputer
ComputelessComputer force-pushed the fix/local-first-interactions branch from 9b2f53a to fb6fa0c Compare July 22, 2026 10:03
Comment thread apps/desktop/src/db/write-queue.ts
@ComputelessComputer
ComputelessComputer force-pushed the fix/local-first-interactions branch from fb6fa0c to 4d49271 Compare July 22, 2026 10:12
Comment thread apps/desktop/src/db/write-queue.ts
@ComputelessComputer
ComputelessComputer force-pushed the fix/local-first-interactions branch from 4d49271 to 5b65d4b Compare July 22, 2026 10:19

@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 2 potential issues.

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 5b65d4b. Configure here.

Comment thread apps/desktop/src/services/calendar/index.ts Outdated
Comment thread apps/desktop/src/shared/hooks/useDeeplinkHandler.ts Outdated
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 5b65d4b to fd4e5b6 Compare July 22, 2026 10:26
@ComputelessComputer
ComputelessComputer merged commit e16b6a7 into main Jul 22, 2026
21 checks passed
@ComputelessComputer
ComputelessComputer deleted the fix/local-first-interactions branch July 22, 2026 10:47
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