-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
fix(vue-query): fix initialData Type Inference Bug in useQuery #9077
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(vue-query): fix initialData Type Inference Bug in useQuery #9077
Conversation
I think we also need to rollback this test case: query/packages/vue-query/src/__tests__/useQuery.test-d.ts Lines 62 to 78 in b397fba
Initially there was no | undefined in the last line
|
As I understand it, when initialData is defined, the type of data should be determined. In the rollback case you suggested, it seems that even though initialData is defined, it returns an undefined type. Please explain why this test case should have an undefined value. I don't understand well :( A test code with the same description as the test for which you suggested a rollback also exists in the React Query tests, and the expected value is defined. query/packages/react-query/src/__tests__/useQuery.test-d.tsx Lines 50 to 64 in b397fba
|
It should NOT have |
Sorry, I misunderstood that my PR was incorrect. I've recognized the issue and completed the fix. I'll push the commit. |
…on returning undefined is used in initialData.
…Data is passed to initialData
View your CI Pipeline Execution ↗ for commit 7684df1.
☁️ Nx Cloud last updated this comment at |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #9077 +/- ##
===========================================
+ Coverage 44.58% 71.10% +26.51%
===========================================
Files 203 19 -184
Lines 8104 481 -7623
Branches 1812 136 -1676
===========================================
- Hits 3613 342 -3271
+ Misses 4059 109 -3950
+ Partials 432 30 -402
🚀 New features to boost your workflow:
|
Thank you for working on the fix. Sorry if I'm missing something but wouldn't it be more correct to add a new test case that will cover minimal repro I provided in the original issue #9069? Like literally add a case for |
Overview
In the previous PR(#9073), there was a bug where data was incorrectly inferred as undefined even when initialData was defined. This PR ensures that when initialData is TData, data is correctly inferred as TData, and adds tests to verify this behavior.
Changes
Bug Fix: Improved type inference for non-undefined initialData
Test Addition: Type validation for defined initialData
Related Files
closes #9069