File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
packages/react/src/hooks/watched Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -55,9 +55,9 @@ export const useWatchedQuery = <RowType = unknown>(
5555 * as soon as the query has been updated. This prevents a result flow where e.g. the hook:
5656 * - already returned a result: isLoading, isFetching are both false
5757 * - the query is updated, but the state is still isFetching=false from the previous state
58- * We only need to override the isFetching status on the initial render where the query changed
59- * (if we report the fetching status). The fetching status will be updated internally in the `updateSettings`
60- * method eventually .
58+ * We override the isFetching status while the `updateSettings` method is running (if we report `isFetching`).
59+ * The query could change multiple times while settings are being updated. In order to cater for this, we
60+ * track the latest update operation promise .
6161 */
6262 if ( queryChanged ) {
6363 // Keep track of this pending operation
@@ -72,7 +72,7 @@ export const useWatchedQuery = <RowType = unknown>(
7272
7373 // Clear the latest pending update operation when the latest
7474 // operation has completed.
75- pendingUpdate . then ( ( ) => {
75+ pendingUpdate ? .then ( ( ) => {
7676 // Only clear if this iteration was the latest iteration
7777 if ( pendingUpdate == updatingPromise . current ) {
7878 updatingPromise . current = null ;
You can’t perform that action at this time.
0 commit comments