Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(query): query refresh on defineQuery output composable call #40

Merged
merged 4 commits into from May 14, 2024

Conversation

ElisePatrikainen
Copy link
Collaborator

@ElisePatrikainen ElisePatrikainen commented May 6, 2024

I noticed that queries defined with defineQuery are not refreshed when the composable returned by defineQuery is called (for example on component mount). Indeed, since, in the case of a defined query, the setup function is only called once (at initiation of the defined query), the queries called inside the setup function are not called again when this composable is reused.

Therefore, in this PR I am testing an idea to address this, which consists in registering (in the defineQueryMap) the queries which are called by the setup function in order to refresh them when the defineQuery output composable is called.

⚠️ Important note: since the queries are registered by registering the queries called while the setup function is running (cf https://github.com/posva/pinia-colada/pull/40/files#diff-ac8c2f7434eefb694c9ead0745e4cd8297e90afe0a9a4c5ba4a54586c7e8596cR195), the current implementation implies that the setup function must be synchronous.

Copy link

netlify bot commented May 6, 2024

Deploy Preview for funny-banoffee-0afb46 canceled.

Name Link
🔨 Latest commit 225a87d
🔍 Latest deploy log https://app.netlify.com/sites/funny-banoffee-0afb46/deploys/6643346c1d125000080f7d14

@posva posva force-pushed the fix-query-refresh-on-defineQuery-output-composable-call branch from d818576 to 28a3ec1 Compare May 14, 2024 07:57
@posva posva marked this pull request as ready for review May 14, 2024 09:48
@posva posva merged commit 225a87d into main May 14, 2024
5 checks passed
@posva posva deleted the fix-query-refresh-on-defineQuery-output-composable-call branch May 14, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants