-
-
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
base: main
Are you sure you want to change the base?
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
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