So I have this problem, and I’m not sure how to solve.
Within my journal query, I have the following result -transform:
:result-transform (fn [r] (map (fn [m] (assoc m :block/collapsed? true)) r))
What this does is that it collapses every block that results from the query. This way, I end up with a neat list - which is itself uncollapsed by default - containing all the tasks I want, where the tasks themselves are collapsed.
However, the side-effect of this approach is that every task has the ‘bullet glow’ of a ‘collapsed task’. Which renders the indicator of which bullet is collapsed (and thus has non-displayed indents) and which does not useless.
So I’m wondering, whether it’s possible to add some kind of check, to make the bullets (tasks) that have no children set as “collapsed? false” and have the bullets (tasks) that do have children as “collapsed? true”. That way, I can see by indicators which bullets (tasks) have additional information attached to them and which don’t.
The difficulty is that Logseq only stores relationships to a blocks parents. And therefore, it’s not obvious to me how to check whether there are children to a block.
I’m optimistic that this is possible. But I just don’t know where to start this challenging puzzle.
Does anyone have some pointers or tips?
Edit: for clarification:
What I have: (all tasks show a glowing bullet)
What the structure is: (only the second task has children)
What I want: (a list with tasks and functioning indicators of which tasks have children)