Repository navigation
fix: preserve current page context in sidebar queries - #13034
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a sidebar rendering inconsistency where embedded/custom queries that depend on the :current-page input could not resolve the correct page context when the page is opened in the sidebar (as reported in logseq/db-test#1049).
Changes:
- Propagate the page’s title into the page render config as
:current-page-titleso query execution can resolve:current-pageconsistently in sidebar contexts.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
f9b0a33 to
4613c08
Compare
| [page option document-mode?] | ||
| (merge {:id (str (:block/uuid page)) | ||
| :db/id (:db/id page) | ||
| :current-page-title (:block/title page) |
There was a problem hiding this comment.
🔴 Zoomed block queries use wrong page
On a zoomed block route, page-render-config supplies the block title to current-page queries. query-current-page-title prefers that title over the query block's parent page, so page filters return wrong results.
Learn more
A zoomed block route passes a block, not a page, into page-blocks-cp. The new title reaches the query resource through query-spec. For Datalog inputs, query-current-page-title uses this title before looking up the query block's owning page. DSL templates use the supplied title directly through variable-rules.
Example: Zoom into a block titled "Milestone" on page "Project" containing a query with :inputs [:current-page]. The input becomes "milestone", not "project", so a filter for the owning page returns no rows.
Recommended fix: Set :current-page-title from the owning page when the rendered entity is a block, rather than from its :block/title. Preserve the rendered page title for actual page routes and sidebar pages; add a zoomed-block query regression test.
Was this helpful? React with 👍 or 👎 to provide feedback.
4613c08 to
303c6b8
Compare
* fix: preserve current page context in sidebar queries * fix: preserve current page context in sidebar queries
* fix: preserve current page context in sidebar queries * fix: preserve current page context in sidebar queries
* fix: preserve current page context in sidebar queries * fix: preserve current page context in sidebar queries
fix logseq/db-test#1049