* test(query-core): add test case for query
* test(query-core): use hashQueryKeyByOptions
* add test case about "should call initialData function when it is a function"
* reflect feedback
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* test(hydration): implement missing hydration tests
* Do not hydrate older promises
* Do not infinite loop on hydrating failed promises
* Hydrate already resolved promises immediately
* fix(hydration): fix promise hydration bugs
* Include dehydratedAt and ignore hydrating old promises
* This is an approximation of dataUpdatedAt, but is not perfect
* Refactor checks for if we should hydrate promises or not to fix infinite loop bug on failed queries
* Hydrate already resolved promises synchronously
* call query.fetch even if sync data was available
* use noop function in tryResolveSync .catch
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* feat(query-core): made "shouldThrowError" function
* refactor(react-query): apply "shouldThrowError" function in react-query package
* refactor(angular-query-experimental): apply "shouldThrowError" function
* refactor(solid-query): apply "shouldThrowError" function
* refactor(vue-query): apply "shouldThrowError" function
* test: add shouldThrowError function test
This is useful for example in thin app shell applications where feature teams provide their dependencies on lazy loaded route providers while still allowing to easily share a QueryClient.
This way the main bundle for the app shell does not include TanStack Query.
The previous suspense example incorrectly rendered null instead of the
fallback UI. This change moves the null check outside the Suspense
component to ensure the fallback is displayed as expected.
Fixes#9019
* test(query-test-utils): init
* refactor(tests): replace createQueryClient with new QueryClient instantiation across test files
* refactor(tests): remove unused imports in utils test file
* refactor(tests): replace fetcher functions with sleep-based implementations in query tests
* refactor(tests): replace simpleFetcher with sleep-based implementations in query tests
* fix(query-core): update test:build script to remove pnpm prefix
* refactor(tests): extract query function into a variable for clarity in useQuery tests
* chore(tsconfig): remove temporary Vitest TypeScript configuration file
* chore: add @tanstack/query-test-utils as a devDependency in multiple packages
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* fix(react-query): fix no error on wrong type annotation
* test(react-query): remove an unused var
* feat: use NoInfer from query-core
* ci: apply automated fixes
* fix: fix eslint error (disable)
---------
Co-authored-by: Jonghyeon Ko <manudeli.ko@gmail.com>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
* fix(types): useSuspenseQuery should type-narrow the Error field
* Update packages/query-core/src/types.ts
Co-authored-by: Jonghyeon Ko <manudeli.ko@gmail.com>
* Update packages/query-core/src/types.ts
Co-authored-by: Jonghyeon Ko <manudeli.ko@gmail.com>
* ref: use DistributiveOmit from query-core in vue-query
* chore: fix type error in tests
---------
Co-authored-by: Jonghyeon Ko <manudeli.ko@gmail.com>