* feat(angular-query-experimental): support injection in injectQuery callback
Before, when creating a query with injectQuery, if you injected dependencies (Like `inject(HttpClient)`) those injections would fail on subsequence changes of dependent signals. That change makes it easier to use `injectQuery` (especially together with `queryOptions` because the query can define its own dependencies.
No breaking changes, any code that worked before should work now as well.
---------
Co-authored-by: Arnoud <6420061+arnoud-dv@users.noreply.github.com>
* bug(codemods): rename CommonJS files to .cjs
Rename CommonJS files in codemods to distinguish them from ES module
files otherwise used in this project.
Resolve an issue occuring since package.json in codemods is removed when
publishing causing module type data to be lost.
Fix issue #7154
* Fix knip errors
* Add file extension to tests
* Update migration doc
---------
Co-authored-by: Lachlan Collins <1667261+lachlancollins@users.noreply.github.com>
* wip - 1
* Fix more links
* Fix one more link
* Another one
* Update a link
* Fix the broken links in the Angular docs
* Fix the broken links in the Vue docs
* Fix the Svelte links in the docs
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* refactor: add scope to mutationCache internally
* refactor: remove unused defaultOptions on mutation
this private field is a leftover from v4
* feat: make sure to not run mutations if there is already one running in the scope of this mutation
* feat: make sure mutations in the same scope can run in serial
* fix: find a _lot_ better way to determine if a mutation can run
* test: widen test scenario to include scopes
* fix: there is a difference between starting and continuing
when starting, we need to check the networkMode differently than when continuing, because of how offlineFirst works (can start, but can't continue)
* refactor: switch to a scope object with `id`
* feat: dehydrate and hydrate mutation scope
* fix: initiate the mutationCache with a random number
since we use the mutationId to create the default scope, and the mutationId is merely incremented, we risk colliding scopes when hydrating mutations into an existing cache. That's because the mutationId itself is never dehydrated. When a mutation gets hydrated, it gets re-built, thus getting a new id. At this point, its id and the scope can differ. That per se isn't a problem. But if a mutation was dehydrated with scope:1, it would put into the same scope with another mutation from the new cache that might also have the scope:1.
To avoid that, we can initialize the mutationId with Date.now(). It will make sure (or at least very likely) that there is no collision
In the future, we should just be able to use `Crypto.randomUUID()` to generate a unique scope, but our promised compatibility doesn't allow for using this function
* test: hydration
* test: those tests actually fail because resumePausedMutations is still wrongly implemented
* fix: simplify and fix resumePausedMutations
we can fire off all mutations at the same time - only the first one in each scope will actually fire, the others have to stay paused until their time has come. mutation.continue handles this internally.
but, we get back all the retryer promises, so resumePausedMutations will wait until the whole chain is done
* test: more tests
* refactor: scopeFor doesn't use anything of the mutationCache class
* docs: scoped mutations
* feat(solid-query): Rework internals of createBaseQuery
This change aims to simplify and enhance the internals of `createBaseQuery`.
This change is a precursor to fix a couple of pressing issues in solid-query mentioned in
#7079#7083#7173#7036#6620#6373
PRs for which are coming soon.
A key few highlights coming with this change:
1. Removal of `mutate` and `refetch` branches in `createClientSubscriber`: We had two different ways of resolving a query resource. The `mutate` option that optimistically updated a resource proved to be a problem with error queries. A query that has `placeholder` data and fails for any reason would see a flash of blank content before yielding to the ErrorBoundary. Using `refetch` for all query resolutions gives us a nice and simple way to transition to error boundaries
2. Removal of batched calls with `notifyManager`: With the new approach we dont need to batch anything. Everything is taken care of automatically. This removes all sideEffects from solid-query as a nice plus
3. Central place to update state: The new `setStateWithReconciliation` function provides a nice and easy way to make the `reconcile` option way more powerful
4. Only accessing the `data` property now would trigger Suspense boundary. Previously any property accessed on a query would trigger the suspense boundary. This was not intentional and has been fixed now
5. Proxied `data` doesn't jump between different values in most cases
The documentation is confusing and not clear about how to use dependent queries in Vue. This PR updates the documentation to make it clear and easy to understand.
discussion: https://github.com/TanStack/query/discussions/7220
* feat(core): memoize result of combine
this PR makes sure to only re-run the combine function if the function itself changed referentially or any of the inputs changed
* docs: combine memoization
* Update docs/framework/react/reference/useQueries.md
TanStack Router uses path-based navigation instead of route-based navigation, so many of the relative documentation links will be invalid after migration. This fixes that.