Block level grouping is lost in query results

Hi, I’m not sure if this is a bug, but when I open a page with query results, the blocks are collapses/grouped incorrectly:
Once I click on the parent block of the first child, all child blocks are displayed and the second task (“a different 1st level block”) is clearly shown to not be a child of “1st task’s 1st level block”
Ideally I’d like to have see only queried tasks (so the 2 from the 1st screen shot), but grouped correctly like on the 2nd.

This is the query used:

{:title "Next 7 days"
  :query [:find (pull ?block [*])
          :in $ ?start ?next
            [?block :block/scheduled ?d]
            [?block :block/deadline ?d])
          [(>= ?d ?start)]
          [(<= ?d ?next)]]
  :inputs [:today :7d-after]
  :result-transform (fn [result] (sort-by (fn [h] get h :block/scheduled)) result)
  :collapsed? false}

So first of, result-transform removes the block groups you would normally see.
There are bug reports/feature requests for this elsewhere on the forum.
Second off it isn’t technically incorrect.
It’s just very unclear.

What you are still seeing is the breadcrumb of that task.
“a different 1st level block” has no breadcrumb and so none is shown.
However due to the distinction in groups missing thanks to the result-transform, your output becomes very unclear.

There are 2 workarounds.

  1. Don’t use result-transform, but this is extremely limiting
  2. Don’t show breadcrumbs, this may also not be preferable, but would remove the confusion.

For the second you can add to your query:
:breadcrumb-show? false
In the list of inputs, result-transform and collapsed.

1 Like

Thanks Siferiax, I tired doing this to get a bit more context visible for results, since transform removes it. Setting breadcrumb-show to false fixes the display issue, but obviously hides the context. I guess this won’t help then.

The fact that “a different 1st level block” shows as a 2nd level block seems like a bug, though.

That’s not technically what is happening.
Hopefully this example might show what I mean.

The top part is the data and the bottom the query you posted.
As you can see the tasks are all displayed as top level and for two of them you see the breadcrumb of the parent they fall under.
So it’s not a bug, just the way it is displayed is unclear. The problem is with the default result-transform that gets overridden.

I wonder if it can be enhanced with css alone, i.e. more margin to the breadcrumbs (and the child along with it) so that it aligns with the text of first-level results… at least with js there’s a chance?

Yes actually. Fiddled around a little bit. Not sure what else is affected by this, but this at least does something :sweat_smile:

  margin-top: 2rem;
1 Like

Thanks, that’s a useful workaround.

if Query with breadcrumbs show blocks on wrong hierarchy · Issue #5859 · logseq/logseq · GitHub is about the same problem, looks like they fixed it :smiley:

Great to hear, thanks for the info.