-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
feat(vue-query): support invoke in vue runWithContext()
#5703
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
feat(vue-query): support invoke in vue runWithContext()
#5703
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
☁️ Nx Cloud ReportCI is running/has finished running commands for commit f67e796. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch
✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit f67e796:
|
Codecov ReportPatch coverage:
❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more. Additional details and impacted files@@ Coverage Diff @@
## main #5703 +/- ##
===========================================
+ Coverage 92.29% 100.00% +7.70%
===========================================
Files 112 13 -99
Lines 4283 400 -3883
Branches 1117 79 -1038
===========================================
- Hits 3953 400 -3553
+ Misses 309 0 -309
+ Partials 21 0 -21
☔ View full report in Codecov by Sentry. |
@Mini-ghost Could you please add a test to verify that |
@DamianOsipiuk I tried it and noticed that Reproduction
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to add a second parameter to inject to avoid Vue warning
7ce97b9
to
f67e796
Compare
Currently, we cannot use
useQuery
anduseMutation
outside ofsetup
, maybe a nuxt plugin or middleware or vue routerbeforeEach
.In Vue 3.3, we can use
app.runWithContext
to look up injections from the values provided by the current app without being restricted to use insetup
This is Vue document example:
Application API | Vue.js # app.runWithContext()
So I adjusted the order of throwing errors, we can try to
inject
first, and if thequeryClient
cannot be found, it will be determined which error message to display according to the result ofgetCurrentInstance()
.This change will not break projects before Vue 3.3, it is backward compatible