0
Fork 0
mirror of https://github.com/TanStack/query.git synced 2026-11-18 19:33:22 +00:00
Commit graph

5,683 commits

Author SHA1 Message Date
Dominik Dorfmeister
57f47e13e1
docs: improve cancellation docs (#2932) 2021-11-12 13:19:37 +01:00
Bernhard Wittmann
35346218bc
docs(optimistic-updates): ease wording in introduction (#2908) 2021-11-11 08:58:20 +01:00
Emmanouil Zoumpoulakis
8065a7e8ed
docs: Typo fixes in Markdown files (#2910) 2021-11-10 20:43:07 +01:00
Arnaud
c118513e83
test(core): 100% code coverage (#2904)
* refactor(logger): assume that console is always defined

* test(utils): isPlainObject: should return `false` if the object has a modified prototype

* test(utils): scheduleMicrotask should throw an exception if the callback throw an error
2021-11-09 11:12:57 +01:00
Louis Law
c917ff7210
chore: add missing eslint-config-prettier for example, (#2898) 2021-11-08 17:25:01 +01:00
Arnaud
c989bde9e1
test(core): improve code coverage (#2876)
* test(InfiniteQueryObserver): should error if queryFn not defined

* test(InfiniteQueryObserver):  should not refetch the first page if refetch another page

* fix(logger): logger is always defined with the console

* test(InfiniteQueryBehavior): move new tests to InfiniteQueryBehavior

* test(QueryCache): add and remove tests

* test(QueryCache): add find with filters.exact defined

fix test.only on previous commit too.

* test(QueryCache): return all queries when no filters are set

fix: comparison in find(); filters object is always defined but could be empty.

* test(mutationObserver): add onUnsubscribe and notify tests

notify: there is no use case in the lib with listeners set to false.

* test(queriesObserver): should not destroy the observer if there is still a subscription

* test(queriesObserver): onUpdate should not update the result for an unknown observer

No onUpdate use case has been found with a possible unknown observer.

* test(queryObserver): the retrier should not throw an error when reject if the retrier is already resolved

* test(InfiniteQueryBehavior): add signal support

* test(hydration): dehydrateQueries false, mutation state pause, hydratedState empty

* test(focusManager): add full coverage tests

* test(query): should set default options

* test(query): should refetch the observer when online method is called

* test(query: should not add an existing observer

* test(query): should not try to remove an observer that does not exist

* test(query): should not dispatch on invalidate if already invalidated

* test(query): reducer should return the state for an unknown action type

Typescript made this case not possible.

* test(query): fetch should not dispatch fetch if meta has not changed

* test(queryClient): setQueryData should use prev data if isDataEqual fct is true

* test(queryClient): setQueryData should set the new data without comparison if structuralSharing is set to false

move related tests into 'setQueryData' test suite

* test(query): fetch should not set the signal  if AbortController is undefined

* test(query): fetch should throw an error if the queryFn is not defined

* test(query): fetch should dispatch fetch if is fetching and current promise is undefined

* test(query): constructor should call initialDataUpdatedAt if defined as a function

* test(queryObserver): should throw an error if enabled option type is not valid

* test(queryObserver): getCurrentQuery should return the current query

* test(queryObserver): should throw an error if throwOnError option is true

* test(queryObserver): should not refetch in background if refetchIntervalInBackground is false

* test(queryObserver): should not use replaceEqualDeep for select value when structuralSharing option is true

* test(queryObserver): add placeholderdata related tests

* fix(queryObserver): shouldNotifyListeners: remove useless condition

updateResult function already check the result with shallowEqualObjects

* test(queryObserver): updateResult should not notify cache listeners if cache option is false

* test(queryObserver): add stale timeout notify test

* test(mutation): setState should update the mutation state

setState is not used in the lib, need to force the usage in the test

* test(mutation): addObserver should not add an existing observer

No use case found, need to use the private method for the test.

* Revert "test(mutation): addObserver should not add an existing observer"

This reverts commit 3643be9518.

* test(mutation): addObserver should not add an existing observer

* test(mutation): executeMutation should throw an error if no mutationFn found

* test(mutation): cancel mutation should not call mutationFn if the current retrier is undefined

Force retryer to undefined because no use case has been found.

* Revert "fix(logger): logger is always defined with the console"

This reverts commit dd64fda076.

* test(mutation): reducer should return the state for an unknown action type

* test(onlineManager): isOnline: add navigator related tests

* test(onlineManager): setEventListener should use online boolean arg

* test(onlineManager): add setEventListener tests

* test(notifyManager): add notifyFn and batchNotifyFn tests

Add a notifyManagerTest singleton because jest.setup.js override notifyFn value.

* test(queryClient): add focusManager and onlineManager related test

* test(queryClient): cancelQueries should not revert if revert is false

* test(queryClient): refetchQueries should throw if throwOnError is true

* test(queryClient): add cancelMutations test

* test(queryClient): should get defaultOptions

* test(queryClient): should update existing query defaults

* test(queryClient): setMutationDefaults should update existing mutation defaults

* test(utils): parseMutationArgs should return mutation options

* test(utils): matchMutation should return false if mutationKey options is undefined

* test(utils): isPlainObject add tests

* test(core): use @ts-expect-error instead of @ts-ignore when possible

* test(core): export NotifyManager for testing purposes

* test(queryObserver): fix test comment
2021-11-07 13:01:37 +01:00
Arnaud
f03396f217
docs(queryCache): fix subscribe callback arg: event instead of query (#2897) 2021-11-07 12:36:38 +01:00
Martin Brodziansky
9edb305f45
fix(types): Export the Mutation type and change default TVariables from void to unknown (#2892) v3.32.1 2021-11-06 22:43:43 +01:00
New Future
b52b2779b3
feat(persistQueryClient): try to clean the old persistented data when storage full (#2851) v3.32.0 2021-11-06 17:52:40 +01:00
Emmanouil Zoumpoulakis
80f236d8c7
fix(devtools): Fix progressively smaller font size for Explorer (#2886)
Fix progressively smaller font size for Explorer entries in devtools
Set Entry font-size to 1em, because it is indented multiple time within each other.
This causes the font to get smaller and smaller as `em` is relative to the parent font size.
2021-11-06 17:50:59 +01:00
Prateek Surana
bfef84c066
chore: Add code coverage report (#2894) 2021-11-06 15:53:11 +01:00
Sam Cook
f348673dce
docs: Add note on AbortSignal version availability (#2887)
Explained that this new AbortSignal feature was introduced at 3.30.0 and that users need to either upgrade (recommended) or use the old cancel function.
2021-11-06 07:34:01 +01:00
Minh
c4fa60eb4d
docs: Minor typo (#2865) 2021-11-01 21:43:55 +01:00
Ben Grynhaus
8013d4a768
feat(persistQueryClient): add optional functions to serialize and deserialize from Storage Persistors (#2864) v3.31.0 2021-10-31 21:00:39 +01:00
henribru
69a5d798fe
docs: Fix typo in query cancellation docs (#2863) 2021-10-30 21:30:12 +02:00
James Wyatt Cready-Pyle
e7a3207f74
feat(useQuery): Provide AbortSignal to queryFn (#2782) v3.30.0 2021-10-30 20:26:57 +02:00
Alex Johansson
f21d932142
fix(types): expose CancelOptions & SetDataOptions (#2855) v3.29.1 2021-10-29 21:17:37 +02:00
Niclas van Eyk
e3fb5668cc
docs: Fix typo (#2850) 2021-10-28 16:31:03 +02:00
Raphaël Huchet
f90455727c
docs: fix typo for placeholder data (#2848) 2021-10-28 14:31:42 +02:00
Dominik Dorfmeister
718903debf
chore: switch from size-limit to bundlewatch (#2845) 2021-10-27 21:55:12 +02:00
Jan Dh
765830c55a
chore: Setup bundle size report (#2837) 2021-10-27 18:05:21 +02:00
Arnaud
6ba663f25a
test(devtools): devtools sort queries test fails on Apple Silicon M1 pro (#2832) 2021-10-27 13:30:48 +02:00
Bennett Dams
1aaca282af
docs: Extend type description of useQuery's onSuccess (#2836) 2021-10-27 13:29:24 +02:00
Arnaud
020bb92d9c
test(react): improve code coverage (#2826) 2021-10-26 22:09:11 +02:00
dohwan joshua kim
51fb925c65
test(useQuery): refetchOnMount test name (#2830) 2021-10-26 21:58:25 +02:00
Luis Felipe Zaguini
4472baea1d
feat(useQuery): add meta field (#2818) v3.29.0 2021-10-26 21:28:38 +02:00
Tanner Linsley
4d762a4ffe
Update index.js 2021-10-26 09:04:56 -06:00
Maful Prayoga Arnandi
461e9887e1
docs(TypeScript): fix useQueries link (#2824) 2021-10-23 21:19:35 +02:00
Arty
2c1d74baf7
feat(useQueries): enable types in useQueries (#2634) v3.28.0 2021-10-23 16:12:00 +02:00
Arnaud
2771a15403
fix(useBaseQuery): set cacheTime to 1 in Suspense mode when cacheTime is set to 0 (#2821) 2021-10-23 16:11:16 +02:00
phatmann
05a8057e2b
docs: Note that calling setQueryData triggers onSuccess (#2808) 2021-10-19 08:11:52 +02:00
Dominik Dorfmeister
255f7c66a8
feat(queryClient): respect cancelRefetch flag (#2798) v3.27.0 2021-10-15 12:44:04 +02:00
Dominik Dorfmeister
35b3836f14
docs(mutations): Update community resources (#2781) 2021-10-10 21:02:48 +02:00
Lucas Genzelis
115895fc92
feat(useInfiniteQuery): respect cancelRefetch flag for infinite queries (fetchNextPage, fetchPreviousPage) (#2731) v3.26.0 2021-10-09 09:24:11 +02:00
Dominik Dorfmeister
ec65515a88
docs(hydration): Document that hydration api requires values to be JSON serializable (#2780) 2021-10-09 09:10:00 +02:00
Jeff Shih
a85d822e24
fix(devtools): replace all instances of rem with em. (#2760) v3.25.1 2021-10-04 08:45:25 +02:00
Cory House
cb22344d4a
docs: Grammar tweaks (#2761) 2021-10-04 07:13:31 +02:00
Dominik Dorfmeister
9e414e8b4f
feat(useQuery): make refetchInterval accept a function (#2622) v3.25.0 2021-10-02 18:16:20 +02:00
Sungmin Chris Yang
36c02b6f3d
fix(broadcastQueryClient): Change broadcastChannel type to optional (#2752) v3.24.6 2021-10-02 15:43:47 +02:00
disflyer
f6ad3098cc
fix(createAsyncStoragePersistor-experimental) fix throttle func (#2739) 2021-09-29 21:43:31 +02:00
Alex
0547e62952
fix(devtools): Default ReactQueryDevtoolsPanel isOpen to true (#2746) v3.24.5
change the `isOpen` prop for the ReactQueryDevtoolsPanel component to default
to true. The subscriptions aren't set up when no isOpen prop is passed, which makes
the panel not show any updates when used without the isOpen prop.

Closes #2745
2021-09-29 20:48:51 +02:00
Noorullah Ahmadzai
a53f6325e9
docs: Return Statement (#2713) 2021-09-24 09:59:48 +02:00
Paul Hammond
f7854e07d5
docs(devTools): Clarify node env logic for devtools (#2711)
Clarify node env logic for devTools to make it clear that the environment should be set to 'development'
2021-09-23 13:05:50 +02:00
Muhammad Al-jefry
10f3d7b8ab
docs: Update persistQueryClient link (#2700) 2021-09-22 21:21:51 +02:00
Muhammad Al-jefry
702bafcf8f
docs: Update persistQueryClient link (#2699) 2021-09-22 21:21:37 +02:00
Richard Lopes
4115417e3e
fix(core): add index.js files to sideEffects (#2703) v3.24.4 2021-09-22 20:40:24 +02:00
Damian Osipiuk
2544f07967
fix(persistQueryClient): import hydration utils from core in persistQueryClient (#2684) v3.24.3 2021-09-19 19:35:25 +02:00
pawlarius
4f8f1c8bae
docs: Add side effect from using setQueryData (#2691) 2021-09-19 16:34:04 +02:00
Dominik Dorfmeister
1beedf9516
fix(core): make sure erroneous queries refetch when query keys change (#2686) v3.24.2 2021-09-19 08:11:34 +02:00
Dominik Dorfmeister
7aadd6896d
fix(types): exclude queryKey / queryFn from options if they have been provided as a separate argument (#2689) v3.24.1 2021-09-18 23:02:36 +02:00