From d1184babd1ba570da09798cad0e8613b7c5b69c8 Mon Sep 17 00:00:00 2001 From: Dominik Dorfmeister Date: Mon, 2 Sep 2024 16:24:13 +0200 Subject: [PATCH] fix: track data property if `promise` is tracked if users use the `promise` returned from useQuery, they are actually interested in the `data` it unwraps to. Since the promise doesn't change when data resolves, we would likely miss a re-render --- packages/query-core/src/queryObserver.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/query-core/src/queryObserver.ts b/packages/query-core/src/queryObserver.ts index 2b4bed1604..04f2b7a88b 100644 --- a/packages/query-core/src/queryObserver.ts +++ b/packages/query-core/src/queryObserver.ts @@ -680,6 +680,9 @@ export class QueryObserver< if (this.options.throwOnError) { includedProps.add('error') } + if (includedProps.has('promise')) { + includedProps.add('data') + } return Object.keys(this.#currentResult).some((key) => { const typedKey = key as keyof QueryObserverResult