Skip to content

Commit fa48673

Browse files
LoicDavidTkDodo
andauthored
perf(query-core): clear query's revertState once fetching ends successfully (#9265)
revertState is used as a fallback for fetching failure. Clearing it once fetching ends successfully improve memory usage, particularly with queries returning large amount of data. Co-authored-by: Dominik Dorfmeister <office@dorfmeister.cc>
1 parent af1de4d commit fa48673

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

packages/query-core/src/query.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,8 @@ export class Query<
604604
fetchMeta: action.meta ?? null,
605605
}
606606
case 'success':
607+
// If fetching ends successfully, we don't need revertState as a fallback anymore.
608+
this.#revertState = undefined
607609
return {
608610
...state,
609611
data: action.data,

0 commit comments

Comments
 (0)