* fix(useQuery): cleanup queries even if they have been fetching
* fix(useQuery): cleanup queries even if they have been fetching
do not re-schedule garbage collection if a query is fetching and we never had any observers subscribed; this is necessary to make suspense work, because with suspense, we always throw before we subscribe, so the garbage collection would prematurely remove the query, resulting in an infinite loop
* fix(useQuery): cleanup queries even if they have been fetching
only schedule garbage collection when the last observer unsubscribes rather than in the constructor
this works around the suspense issue because we only add observers after we've loaded as we throw before that.
if you useErrorBoundary, you're likely not observing the error, because you're not using the returned error field - the ErrorBoundary handles the error for you. So when the actual error then happens, we don't inform the observer about it, because we're only informing them if a prop has changed that they are interested in, resulting in the error boundary never being shown.
The solution would be to always track the error property if you've set useErrorBoundary
* fix(devtools): improve devtools container a11y
default element changes to aside from footer because aside
represents a portion of a document whose content is only indirectly
related to the document's main content.
aria-label is also added to replace the text "generic" in a11y tree.
* fix(devtools): add aria to devtools toggle button
aria-expanded indicates open/closed of the menu
aria-haspopup indicates this is a menu button
aria-controls to link to the menu, also added aria-label on the menu to
label it.
Read more: https://www.w3.org/TR/wai-aria-practices/examples/menu-button/menu-button-links.html
* fix(devtools): menuitem are visible in a11y tree in closed devtools
This is because the element is just hidden visually, but is still inside
the DOM. The added conditional display only affects the inner container,
which means the animation of opening/closing is reserved.
the fix for disabled queries was wrong, because disabled queries still need to throw if they are fetching due to some other means, like `refetch`. However, if a query has just been reset, we want to skip throwing for one render cycle. The useEffect that clears the reset will then make sure that further errors will be thrown
* 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
* 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
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.
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.