* feat: tag the queryKey returned from queryOptions so that it knows about types of the queryFn
* feat: overloads for getQueryData / setQueryData
to infer types from queryOptions
* test: type-tests for queryClient to avoid regressions
* refactor: rename
* refactor(types): simplify options
interestingly, this also solves other types issues we had 🤯
* test: more tests for queryOptions
* fix(types): fetchInfiniteQuery should work when getNextPageParam is passed even if pages isn't
* feat(types): infiniteQueryOptions
* test: this should work
* fix(types): fix typing for setQueryData when only a value is passed
by making sure TS doesn't infer types from there
also, move from overloads to conditional return types
* refactor: re-use Updater type
* chore: fix tests
* chore: do an actual assertion
* refactor: remove ValidateQueryOptions
as it's not used anymore
* docs: queryOptions
* docs(typo): fix typo in word "semi-colon"
remove hyphen from word. Now "semicolon"
* docs(typo): fix grammar error
Replace "it's" with "its"
* docs(typo): fix grammar error
Replace "along side" with "alongside"
* docs(typo): fix spelling error
Replace "fallback" with "fall back". Fallback can only be used as a noun
* feat: allow editing string field values
* feat: make arrays clearable
* feat: add clear list icon
* feat: allow editing number values
* feat: make array items deletable
* chore: use ClearArray button component
* chore: clean up code
* test: add test for deletion
* chore: inline prop types
* chore: make dataPath optional
* chore: clean up button props
* test: use inline snapshots for data checks
* feat: use setQueryData for setting newData
* feat: use ts-expect-error
* feat: make more data types deletable
* feat: allow editing in Maps and Sets
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* feat: add stable-query-client rule
This commit introduces a new rule in the eslint-plugin-query package. The rule, named 'stable-query-client', ensures that the QueryClient is
stable. It checks if the QueryClient is either extracted from the component or wrapped in React.useState. If not, it suggests a fix to wrap
the QueryClient instantiation in a React.useState call. This rule is recommended to be set as an error.
* update recommended snapshot
* fix eslint
* check only immediate instantiation
* fix: allow QueryClient invocation in react server components
Updated the stable-query-client rule to allow the invocation of QueryClient inside react server components.
* docs: stable-query-client
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* docs(useQuery): explain identity function for placeholderData
clarify the usage of an identity function when used with placeholderData
* docs(useQuery): remove the word exported
remove the word exported regarding keepPreviousData
* docs(react-query): add Request Waterfalls guide
Also includes initial scaffold for new prefetch/SSR docs structure
* docs(react-query): update prefetching guide
* docs(migration-guide): add more hydration api changes to migration guide
* docs(prefetching): polish prefetching docs
* docs(react-query): rewrite ssr doc page
* docs(react-query): add advanced server rendering guide
* docs(react-query): add clarifications to ssr docs
* docs(react-query): add note about Suspense for streaming ssr plugin
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* feat(devtools): fix restore/trigger loading cond
* fix eslint
* use queryStatus for the trigger loading state
* disable trigger error while state loading
* disable invalidate and reset on status pending
---------
Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
* fix(react-query-persist-client): decouple subscribe and unsubscribe
to make sure subscriptions are always done at the end, even if we unsubscribe while we're restoring
* chore: fix types
* chore: I think this is better