Skip to content

Commit d1184ba

Browse files
committed
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
1 parent 36d367a commit d1184ba

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/query-core/src/queryObserver.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,9 @@ export class QueryObserver<
680680
if (this.options.throwOnError) {
681681
includedProps.add('error')
682682
}
683+
if (includedProps.has('promise')) {
684+
includedProps.add('data')
685+
}
683686

684687
return Object.keys(this.#currentResult).some((key) => {
685688
const typedKey = key as keyof QueryObserverResult

0 commit comments

Comments
 (0)