Closed Peeja closed 7 years ago
After further investigation: In set-query!
, after this swap!
, (get-query c)
is correct, where c
is the PetsPage
component whose query is being set, because it finds the new query in the ::queries
in the app state. However, (get-query root)
has the wrong ident, as it has no entry in ::queries
. This is why the subsequent p/reindex!
fails.
fixed 1ce79f114fc602660a1c2e2e09ac4e9d85f8b54f
Demonstrated here, on the devcard
om.devcards.core/test-query-setting
.The card shows the current user's pets. Clicking a pet in the sidebar selects the pet, and shows more info in the main area. This is accomplished with
set-query!
.However, when "Jasmine" is clicked, the app throws an error. The error comes from the indexer, which is trying to focus the old root query,
to the new path,
[:om.devcards.core/route-data [:pet/by-id 1]]
. That is, the query it's focusing has Alfred's ident,[:pet/by-id 0]
, but the path it's focusing has Jasmine's,[:pet/by-id 1]
. This leads to an error inquery-template
.It's also entirely possible I'm doing something wrong, in which case I'd be happy to be told what that is. 😃