Skip to content

fix(worker): answer read thread-apis before the graph is open - #13862

Closed
yuxi-liu-wired wants to merge 2 commits into
logseq:masterfrom
yuxi-liu-wired:fix/thread-api-before-graph-open
Closed

yuxi-liu-wired wants to merge 2 commits into
logseq:masterfrom
yuxi-liu-wired:fix/thread-api-before-graph-open

Conversation

@yuxi-liu-wired

@yuxi-liu-wired yuxi-liu-wired commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Answer read thread-apis before the graph is open

Right after a reload the renderer sends graph-scoped read thread-apis as soon as it renders, before :thread-api/create-or-open-db has run, so frontend.worker.state/get-datascript-conn is still nil for the graph. Most read handlers already wrap the conn in when-let; these did not:

  • :thread-api/get-blocks returned nil, and frontend.db.async logged :db/block-fetch-failed {:operation :get-block, :block "Contents", :error "Unexpected get-blocks response count" {:request-count 1, :response-count 0}} (the right sidebar's Contents page);
  • :thread-api/get-view-data, :thread-api/favorited-page? and :thread-api/get-all-page-titles deref the nil conn and throw No protocol method IDeref.-deref defined for type null.

:thread-api/build-graph throws the same way but keeps that behaviour: the global graph view shows the error with a retry, while a nil would be stored as a finished graph and leave the view on "Preparing".

Found by a local key fuzzer that reloads mid-session.

Change

  • frontend.worker.handler.block: get-blocks answers each request with a missing block ({:id id}), which the renderer already treats as not found.
  • frontend.worker.handler.view (get-view-data) and frontend.worker.handler.graph (favorited-page?, get-all-page-titles): the same when-let on the conn as the neighbouring read handlers; they return nil (false for favorited-page?) until the graph is open.

Nothing changes once the conn exists. Write handlers are unchanged: the renderer doesn't send them during startup, and an error is still the right answer there.

Tests

New src/test/frontend/worker/handler/graph_not_open_test.cljs, for a repo with no conn:

  • get-blocks-answers-each-request-before-graph-opens-test: one result per request, each a missing block (fails on master: nil).
  • read-thread-apis-return-empty-before-graph-opens-test: view, favourite and page-title reads return nil/false without throwing.

CI's unit suite and lint pass locally.

Right after a reload the renderer sends graph-scoped read thread-apis
before the worker has opened the graph (worker-state/get-datascript-conn
is still nil). A local key fuzzer that reloads mid-session hit:

- :thread-api/get-blocks returned nil, so frontend.db.async logged
  ":db/block-fetch-failed ... Unexpected get-blocks response count" (the
  right sidebar's Contents page);
- :thread-api/build-graph threw "No protocol method IDeref.-deref
  defined for type null"; get-view-data, favorited-page? and
  get-all-page-titles deref the conn the same way.

get-blocks now answers each request with a missing block ({:id id}),
which the renderer already treats as not found; the others use the
same when-let on the conn as the read handlers next to them and return
nil (false for favorited-page?). Nothing changes once the conn exists.

graph-not-open-test calls these thread-apis for a repo with no conn;
the get-blocks case fails without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 27, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 2 potential issues.

Devin Review

Comment on lines 123 to 124
(when-let [conn (worker-state/get-datascript-conn repo)]
(graph-view/build-graph @conn option)))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔴 Global graph stalls on early reads

When build-graph runs before the graph opens, it returns nil as a successful build. load-global-graph! stores nil, leaving the graph on Preparing without an error or retry button.

Learn more

A global graph load treats any resolved value as completed graph data. Before the worker has a connection, this handler resolves nil rather than rejecting. load-global-graph! stores the nil result and clears loading, while global-graph-content renders Preparing when graph data is nil and only exposes Retry when there is a build error. The effect also tests nil as unloaded and can request again when its data map changes.

Example: Open the global graph immediately after a reload, before create-or-open-db finishes. The early build returns nil; the view has no graph and no error button instead of waiting for the graph to open and then building it.

Recommended fix: Gate the graph load in load-global-graph! on graph-open readiness or explicitly retry it when the graph becomes ready. Keep nil responses out of the successful graph-data path, and avoid an unconditional nil-result retry loop.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

Comment on lines +704 to +709
(if (worker-state/get-datascript-conn repo)
(get-blocks-response repo requests)
;; Before the worker has opened the graph (e.g. right after a reload),
;; answer every request as a missing block: the renderer expects one
;; result per request.
(mapv (fn [{:keys [id]}] {:id id}) requests)))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔍 Contents sidebar lacks an open-triggered reload

An early missing-block result leaves Contents absent. sidebar-item-inner loads only on mount; verify that graph restore remounts it.

Devin Review


Was this helpful? React with 👍 or 👎 to provide feedback.

A nil from :thread-api/build-graph is stored by load-global-graph! as a
finished graph, which leaves the global graph view on "Preparing" with
no error or retry. Before the graph is open the thrown error is the
better answer (the view shows it with a retry), so build-graph is back
to master's behaviour.
@yuxi-liu-wired

Copy link
Copy Markdown
Contributor Author
  • build-graph: agreed, a nil is taken as a finished graph and leaves the view on "Preparing" with no retry. The latest commit puts build-graph back as on master (it throws before the graph is open, and the view shows the error with its retry); the test no longer covers it.
  • Contents: before this change the early fetch failed and Contents was missing as well (with a logged block-fetch-failed); this keeps the same visible result without the error. Re-fetching sidebar items once the graph opens would be a separate change to the sidebar.

@yuxi-liu-wired

Copy link
Copy Markdown
Contributor Author

Superseded by #13864, which fixes the cause instead of each handler: calls for a graph that is still opening now wait for the open in remote-function, so they see the opened graph. This PR's commits are included there as the backstop for calls that arrive when no open is in flight. Closing to keep the fix for this class in one place.

yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 27, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 29, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 29, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 30, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 30, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 31, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 31, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 1, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 2, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 3, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 3, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 4, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 11, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 11, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 12, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 12, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 13, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 14, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 15, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 16, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 16, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
@yuxi-liu-wired
yuxi-liu-wired deleted the fix/thread-api-before-graph-open branch November 17, 2026 02:20
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 17, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 17, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 18, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 18, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 18, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 18, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 18, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 18, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Nov 18, 2026
Right after a reload the renderer can call :thread-api/get-class-objects,
:thread-api/get-property-values and
:thread-api/get-bidirectional-properties before the worker has opened
the graph; they deref the graph's nil conn and throw "No protocol method
IDeref.-deref defined for type null". They now use the same when-let on
the conn as the neighbouring read handlers and return nil until the
graph is open (the same change for the other read handlers is logseq#13862;
this file is already in this PR).

property-read-thread-apis-return-nil-before-graph-opens-test calls the
three for a repo with no conn; all three throw without the change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant