How can I update a collection from different locations referencing the same queryKey? #823
Unanswered
TotiCuervo
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have abstracted a collection to a hook for reusability. I have a page, PageA, that uses that collection via a useLiveQuery. Nested in PageA is a component, ComponentB, where I would like to be able to manipulate the collection. My expectation is that I could call up and manipulate my collection and it would persist both in PageA and ComponentB. So far it seems like Collections are not global to the rest of the app but are isolated to the place where it is initialized. I am expected my change in ComponentB to have impacted all todos at the queryKey 'todos'.
I am trying to update a collection in a place separate from where the useLiveQuery is. I expected Collections to be similar to useQuery where I can reference the same queryKey in different components, make changes, and those changes would persist throughout the other places the query is used.
Is there something that I am missing in my understanding or am I just doing something wrong? I could prop drill the function I want to use, but that feels like it defeats the point.
Hook:
PageA
ComponentB
Beta Was this translation helpful? Give feedback.
All reactions