You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and used in multiple components, the page will end up scoped to the first component that calls it. Both components will create a page ref but only the first one will be used within query and key. Therefore, if the first component is unmounted while the other still lives, the page ref will not be reactive anymore, breaking the usage.
Notes
An eslint plugin could warn agains this usage. It would be better to have some runtime warning but not sure how to do it, maybe checking for the active scope and saving it somewhere in dev only?
I think a good version would be defineQuery(() => { ...}) similar to a setup store. This looks like a composable and behaves like one except it's a singleton
maybe a
defineQuery(() => {})
to allow using globals and creating global state associated with the query (e.g. a page?).Currently one can try to do this:
But this can fail in some scenarios, notably if the same key is used in a different component or if this gets abstracted with
and used in multiple components, the
page
will end up scoped to the first component that calls it. Both components will create a page ref but only the first one will be used within query and key. Therefore, if the first component is unmounted while the other still lives, the page ref will not be reactive anymore, breaking the usage.Notes
The text was updated successfully, but these errors were encountered: