Repository navigation
feat: Adds support for :query-page as an input - #8449
Conversation
|
@bendyorke is this a new feature, an enhancement or a bug fix? |
|
@Bad3r technically a new feature I guess, however it fixes a couple issues people are having embedding queries. I've added the feature label |
I see, thank you! btw, if you add |
This PR doesn't resolve that issue as it is for a simple query, which has a different implementation than the advanced query that this PR touches. This is noticeable as the two queries have different results for the case that the user shared: Here's the steps to reproduce:
In page "page 8449": A followup PR to add this functionality to the simple query would be nice some time |
logseq-cldwalker
left a comment
There was a problem hiding this comment.
@bendyorke Thanks for adding a useful input for embed contexts! 👍 ⚡Would be great to have this documented along with inputs from #8387
| (is (= ["+1d" "now"] (blocks-journaled-between-inputs :today :today/+1d)) | ||
| ":today/+1d and today resolve to correct journal range"))) | ||
|
|
||
| (deftest resolve-input-for-query-page |
| :in $ ?start ?end | ||
| :where (between ?b ?start ?end)]}))) | ||
|
|
||
| ; (let [block-uuid (-> (db-utils/q '[:find (pull ?b [:block/uuid]) |
There was a problem hiding this comment.
Some debugging stuff to remove. Easy enough to fix
8bc52e1 to
19c2f44
Compare

This adds support for
:query-pageas an input for advanced queries. This resolves issues such as #6528 (I'll look up more issues in a moment).Logseq at the moment provides a
:current-pageand<% current page %>input type that resolves to the page open in the current window. Embedding blocks that contain any queries using these inputs causes the results to change depending on where the block is shown. This adds an alternate input:query-page, that will resolve to the page of the block of that query originally comes from.Currently this does not add
<% query page %>to simple queries, as we are not currently providing the current block id to simple queries which makes it a little tricker, and this is namely to support the journal day queries in advanced queries. That functionality should maybe be added eventually.Here is a screenshot showing the test cases in action, with four queries from
#task-a, and the same four queries embedded from a page on#task-b.The four queries are: