File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
packages/toolkit/src/query/core Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -136,7 +136,8 @@ export function buildSlice({
136
136
extraReducers ( builder ) {
137
137
builder
138
138
. addCase ( queryThunk . pending , ( draft , { meta, meta : { arg } } ) => {
139
- if ( arg . subscribe ) {
139
+ const upserting = isUpsertQuery ( arg )
140
+ if ( arg . subscribe || upserting ) {
140
141
// only initialize substate if we want to subscribe to it
141
142
draft [ arg . queryCacheKey ] ??= {
142
143
status : QueryStatus . uninitialized ,
@@ -148,7 +149,7 @@ export function buildSlice({
148
149
substate . status = QueryStatus . pending
149
150
150
151
substate . requestId =
151
- isUpsertQuery ( arg ) && substate . requestId
152
+ upserting && substate . requestId
152
153
? // for `upsertQuery` **updates**, keep the current `requestId`
153
154
substate . requestId
154
155
: // for normal queries or `upsertQuery` **inserts** always update the `requestId`
You can’t perform that action at this time.
0 commit comments