Skip to content

Advanced Query | Result-Transform breaks advanced query #236

@C0ntr0lledCha0s

Description

@C0ntr0lledCha0s

Search first

  • I searched and no similar issues were found

What Happened?

I had an advanced query working, added the following code and got a "Something went wrong" error

:result-transform (fn [results]
                     (sort-by (fn [h]
                                (or (get h :logseq.task/scheduled)
                                    ;; Default to nil if no scheduled date
                                    (get h :logseq.task/deadline))) results))

Error caught by UI!.txt

Full query is below:

{
    :query [:find (pull ?b [*])
            :in $ ?end-time             
            :where
             (task ?b #{"Backlog" "Todo" "Doing" "In Review"})
             (not (page-ref ?b "template"))
             (or-join (?b ?end-time)
                (priority ?b #{"Urgent"})
                (and
                	 (priority ?b #{"High"})
              		 (or [?b :logseq.task/scheduled ?n][?b :logseq.task/deadline ?n])
              		 [(<= ?n ?end-time)]
                )
            )
            ]
    :inputs [:+7d-ms]
 	:result-transform (fn [results]
                     (sort-by (fn [h]
                                (or (get h :logseq.task/scheduled)
                                    ;; Default to nil if no scheduled date
                                    (get h :logseq.task/deadline))) results))
    :breadcrumb-show? true
    :group-by-page? true
    :collapsed? true
   }

This error occurs at the page level, if viewing the query at the node level or through a Linked reference it seems to work fine.

Reproduce the Bug

Image

Expected Behavior

If the error is query related, it should just not render or throw a warning error on the page

Files

logseq_db_Templates-debug-datoms_1742810006.zip

Browser, Desktop or Mobile Platform Information

No response

Additional Context

No response

Are you willing to submit a PR? If you know how to fix the bug.

  • I'm willing to submit a PR (Thank you!)

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions