Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: keep graphs list usable when db-worker is nil - #13064

Draft
tiensonqin wants to merge 3 commits into
masterfrom
logseq/fix-graphs-list-nil-worker-1bfa
Draft

fix: keep graphs list usable when db-worker is nil#13064
tiensonqin wants to merge 3 commits into
masterfrom
logseq/fix-graphs-list-nil-worker-1bfa

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Fixes logseq/db-test#1077

After a failed graph open or worker recovery, *db-worker can be nil. <invoke-db-worker used to throw db-worker has not been initialized synchronously. Promesa p/let does not catch that first-binding throw, so React render, RFX, restore, and All graphs hit ErrorBoundary (“Something is wrong”) instead of a recoverable empty/error state.

Change

  • <invoke-db-worker always returns a promise and rejects when the worker is missing, instead of throwing.
  • Browser <list-db> returns [] when the worker is not ready (no SQLite error toast / reload loop).
  • :graph/sync-context no-ops unless the worker is ready.
  • Renderer subscription hooks treat an uninitialized-worker error as empty data instead of throwing into ErrorBoundary.
  • Failed restore still clears :graph/loading? and keeps the current graph so the graphs list remains usable.

Not in scope: db-test#1076 (import NPE), #1066/#1074 (sleep/wake reconnect), #927 (import recovery).

Tests

  • frontend.state-test/invoke-db-worker-with-nil-worker-rejects-without-throwing
  • frontend.persist-db-test/browser-list-db-with-nil-worker-returns-empty-without-throwing
  • frontend.db.restore-test/restore-graph-with-nil-worker-rejects-without-throwing
  • frontend.db.hooks-test uninitialized worker error does not throw from use-block
  • frontend.handler.events-test :graph/sync-context nil-worker / ready
  • frontend.undo-redo-test/undo-redo-with-nil-worker-does-not-throw-test
  • frontend.components.repo-test/graph-e2ee-enabled-with-nil-worker-does-not-throw
Open in Web Open in Cursor 

cursoragent and others added 3 commits August 17, 2026 18:42
After a failed graph open or worker recovery, *db-worker can be nil.
<invoke-db-worker threw synchronously, so All graphs and restore/sync-context
hit React ErrorBoundary instead of a recoverable empty/error state.

Reject the missing-worker case as a promise, skip worker-backed list-db, and
avoid throwing that error from renderer subscriptions.

Co-authored-by: Tienson Qin <[email protected]>
Read event-definitions as an atom, and set *db-worker in undo/redo proxy tests so the ready? guard does not skip the redef.

Co-authored-by: Tienson Qin <[email protected]>
Call done after promesa with-redefs restores bindings so restore tests cannot overlap. Assert db-worker-ready? before checking that sync-context invokes the worker.

Co-authored-by: Tienson Qin <[email protected]>
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.

Graph doesn't load

2 participants