I have a similar setup. After a lot of trial and error, I landed at the following query, based on this hint:
#+BEGIN_QUERY
{ :title "List tasks within namespace"
:query [:find (pull ?b [*])
:in $ ?current-page %
:where
[?b :block/marker ?marker]
[?b :block/page ?p]
[(contains? #{"TODO"} ?marker)]
[?ns :block/name ?current-page]
(ns-rec ?p ?ns)
]
:inputs
[:current-page
[
[[ns-rec ?b ?ns]
[(= ?b ?ns)]]
[[ns-rec ?b ?ns]
[?b :block/namespace ?ns]]
[[ns-rec ?b ?ns]
[?child :block/namespace ?ns]
(ns-rec ?b ?child)]]]
:result-transform (fn [result]
(->> result
(map (fn [r] (assoc r :block/properties {"priority" (get r :block/priority)})))
)
)
:collapsed? False
}
#+END_QUERY