* test: stabilize the test for notifying query cache when a query becomes stale
* test: stabilize the test for notifying query cache when a query becomes stale - attempt#2
* test: stabilize the test persisting data when enabled is changed to false
* test: stabilize the test for rendering with selected data
* test: stabilize the test for notifying query cache when a query becomes stale - attempt#3 (thanks TkDodo)
* test: stabilize the test for keeping the previous data when keepPreviousData is set
* makes consistent sentences
* makes query option data possible to read without horizontal scrolling
since the change to use the object syntax, a few of these fall off the codeblock at 100% zoom (whereas they didn't before).
* moves placeholder docs after initial-query docs
upon reading though top-to-bottom, since placeholder data's docs define themselves _in terms of_ initial query data, it may make sense to introduce initial query data first
* simplifies example
if the purpose of having a return is to really highlight that this can be a function and things can be done inside it maybe adding:
```
// do any work expensive work here
```
inside the curly braces before the return would do a better job? not sure, but this seems reasonable. just doing `initialData: getExpensiveTodos` doesn't immediately highlight that this is a function being called (rather than an array of objects or something) so makes sense to leave the noop closure.
* moves wrapping comments to be visible without horizontal scrolling
* test: stabilize test for selecting a part of the data with select
* test: stabilize test for resolving promises after reconnect
* test: stabilize test for throwing a CancelledError when a paused query is cancelled
* test: stabilize test for selecting a part of the data with select (object syntax)
* test: stabilize test for cancelling query when there are no more subscriptions
* test: apply formatting
* add @tanstack/eslint-plugin-query
* fix .eslintrc rule name
* make rule compatible with babel parser
* fix script typo
* remove dedicated example in favor of the basic example
* align package version with the other packages
* align eslint-plugin-query version
* fix displayName
* remove typescript from package
* omit call expressions from keys without the need of whitelist
* lint queryKey instead of useQuery
* update pnpm-lock.yaml
* fix auto-fix suggestion for complex ast
* better inline query key
* fix typo
* update scripts
* restore .eslintrc
* update typescript-eslint packages
* support member expression keys
* format
* should not fix with duplicate keys
* format
* empty commit (flaky test)
* should ignore keys from callback
* Update packages/eslint-plugin-query/package.json
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* add prefer-query-object-syntax rule
* fix indention
* fix headline
* add rule description
* fix lint errors
* widen import check for all adapters
* add support for solid-query (createQuery)
* docs: add eslint plugin section
* prettier
* move docs
* EsLint -> ESLint
* fix typo
* add missing dep
* update lockfile
* give credit where credit is due
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
previousData is data that we want to show from a previous observer if we don't have any good data in the cache already. InitialData is always considered good data, just as if it were data that has been fetched. It might be potentially stale, but that's something that can be controlled via staleTime and initialDataUpdatedAt.
So that means we shouldn't show previousData if we also have initialData
* feat: deprecate isDataEqual
* feat: deprecate contextSharing
* feat: deprecate custom loggers
* test: fix ssr-hydration tests
we need to compare against actual console.log here (and not our own logger), because react hydration mismatches are also logged to the console if they exist. This has surfaced another issue because of how we import react for react17/18 differential testing.
* fix: remove useEffect
that would wind up empty in production, and since this is just during development mode, we can just log during render
* test: adapt tests
we can remove most of these in v5
* chore: fix console.mock declaration
* feat: deprecate placeholder data function
* chore: scope test execution to src directories
if we do `pnpm test` locally, it first does typechecking, which produces output in `build` (including test files). Those will then be tested as well and the svelte tests fail with that.
* test: fix vue query test
* un-deprecate placeholderData function
we might still need it after all - to be discussed
* un-deprecate placeholderData function
* fix auto import
* docs: useQuery to object syntax
* docs: invalidateQueries to object syntax
* docs: useMutation to object syntax
* docs: infinite query and other references to object syntax
* fix: consistent punctuation in list
two of these have periods and two don't... so I looked around at what is done elsewhere and took my best guess
* adds linkback to docs for refetchOnWindowFocus
at this point in the readthrough, this is the very first time I'm seeing anything about "options" and having a link to one is nice, just to quickly see what they look like and hop right back to this page. I'd love to add some docs to the 4 that are mentioned in the next paragraph but they don't seem to have a way to link to them since they're contained in an unordered list on the useQuery page
* moves asides to be in context with attached bullets
I don't see how to run the docs site locally to test this, but at least on GitHub's markdown parser this would really help align the quote block with the associated bullet (as it is today is sorta hard to follow because some are global and some are attached to bullets, yet they're all at the same level).
feel free to drop this commit if it doesn't work for the actual markdown parser.
* adds missing inline codeblock for signal obj
* matches QueryFunctionContext types to source code
see 759aa0a89c/packages/query-core/src/types.ts (L24)
following the standard of https://www.typescriptlang.org/tsconfig#exactOptionalPropertyTypes these types are subtly incorrect.
* fix multiple h1s on page (and this one pushing above)
check out https://tanstack.com/query/v4/docs/guides/background-fetching-indicators#displaying-global-background-fetching-loading-state
and see that the section that's an h1 at the bottom is pushed pretty hard up against the codeblock before it. I think this is some kind of tailwind problem, but it's a win-win because a page having multiple h1 elements is an accessibility nit anyways
* test: stabilize a flaky test for notifyOnChangeProps
* test: stabilize a flaky test for cacheTime 0 and rerendering
* test: add sleep to make sure no additional renders are happening after data is successfully fetched for the second time
* test: stabilize test for switching to a disabled query
* test: small improvements to a test for disabled query
* test: stabilize test for "previous data on disabled query when keepPreviousData is set"
* test: run prettier
* feat(query-core): Expose retry error as `failureReason`
* feat: Add `failureReason` to mutation as well
* fix: mutation `failureCount` not being reset to `0` on success
* chore: Add tests for mutation loading state reset
* fix: linting + tests