Skip to content

fix: preserve current page context in sidebar queries - #13034

Merged
tiensonqin merged 2 commits into
masterfrom
fix/current-page-sidebar-query
Sep 30, 2026
Merged

tiensonqin merged 2 commits into
masterfrom
fix/current-page-sidebar-query

Conversation

@megayu

@megayu megayu commented Aug 17, 2026 •

Copy link
Copy Markdown
Collaborator

Copilot AI 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.

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-title so query execution can resolve :current-page consistently in sidebar contexts.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@tiensonqin
tiensonqin force-pushed the fix/current-page-sidebar-query branch from f9b0a33 to 4613c08 Compare September 30, 2026 15:05

@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 1 potential issue.

Devin Review

[page option document-mode?]
(merge {:id (str (:block/uuid page))
:db/id (:db/id page)
:current-page-title (:block/title page)

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.

🔴 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.

Devin Review


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

@tiensonqin
tiensonqin force-pushed the fix/current-page-sidebar-query branch from 4613c08 to 303c6b8 Compare September 30, 2026 15:26
@tiensonqin
tiensonqin merged commit 7f4cb08 into master Sep 30, 2026
9 checks passed
@tiensonqin
tiensonqin deleted the fix/current-page-sidebar-query branch September 30, 2026 15:26
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 1, 2026
* fix: preserve current page context in sidebar queries

* fix: preserve current page context in sidebar queries
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 8, 2026
* fix: preserve current page context in sidebar queries

* fix: preserve current page context in sidebar queries
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 8, 2026
* fix: preserve current page context in sidebar queries

* fix: preserve current page context in sidebar queries
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.

Queries that use 'current-page' input fail to load results in side-bar

3 participants