@tanstack/query-core 5.0.0-alpha.48 → 5.0.0-alpha.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js +0 -13
- package/build/lib/_virtual/_rollupPluginBabelHelpers.esm.js.map +0 -1
- package/build/lib/focusManager.esm.js +0 -87
- package/build/lib/focusManager.esm.js.map +0 -1
- package/build/lib/hydration.esm.js +0 -87
- package/build/lib/hydration.esm.js.map +0 -1
- package/build/lib/index.esm.js +0 -14
- package/build/lib/index.esm.js.map +0 -1
- package/build/lib/infiniteQueryBehavior.esm.js +0 -127
- package/build/lib/infiniteQueryBehavior.esm.js.map +0 -1
- package/build/lib/infiniteQueryObserver.esm.js +0 -76
- package/build/lib/infiniteQueryObserver.esm.js.map +0 -1
- package/build/lib/mutation.esm.js +0 -259
- package/build/lib/mutation.esm.js.map +0 -1
- package/build/lib/mutationCache.esm.js +0 -96
- package/build/lib/mutationCache.esm.js.map +0 -1
- package/build/lib/mutationObserver.esm.js +0 -126
- package/build/lib/mutationObserver.esm.js.map +0 -1
- package/build/lib/notifyManager.esm.js +0 -89
- package/build/lib/notifyManager.esm.js.map +0 -1
- package/build/lib/onlineManager.esm.js +0 -88
- package/build/lib/onlineManager.esm.js.map +0 -1
- package/build/lib/queriesObserver.esm.js +0 -205
- package/build/lib/queriesObserver.esm.js.map +0 -1
- package/build/lib/query.esm.js +0 -469
- package/build/lib/query.esm.js.map +0 -1
- package/build/lib/queryCache.esm.js +0 -109
- package/build/lib/queryCache.esm.js.map +0 -1
- package/build/lib/queryClient.esm.js +0 -320
- package/build/lib/queryClient.esm.js.map +0 -1
- package/build/lib/queryObserver.esm.js +0 -528
- package/build/lib/queryObserver.esm.js.map +0 -1
- package/build/lib/removable.esm.js +0 -36
- package/build/lib/removable.esm.js.map +0 -1
- package/build/lib/retryer.esm.js +0 -153
- package/build/lib/retryer.esm.js.map +0 -1
- package/build/lib/subscribable.esm.js +0 -26
- package/build/lib/subscribable.esm.js.map +0 -1
- package/build/lib/utils.esm.js +0 -227
- package/build/lib/utils.esm.js.map +0 -1
|
@@ -1,528 +0,0 @@
|
|
|
1
|
-
import { classPrivateFieldLooseBase as _classPrivateFieldLooseBase, classPrivateFieldLooseKey as _classPrivateFieldLooseKey } from './_virtual/_rollupPluginBabelHelpers.esm.js';
|
|
2
|
-
import { shallowEqualObjects, replaceData, noop, isServer, isValidTimeout, timeUntilStale } from './utils.esm.js';
|
|
3
|
-
import { notifyManager } from './notifyManager.esm.js';
|
|
4
|
-
import { focusManager } from './focusManager.esm.js';
|
|
5
|
-
import { Subscribable } from './subscribable.esm.js';
|
|
6
|
-
import { canFetch } from './retryer.esm.js';
|
|
7
|
-
|
|
8
|
-
var _client = /*#__PURE__*/_classPrivateFieldLooseKey("client");
|
|
9
|
-
var _currentQuery = /*#__PURE__*/_classPrivateFieldLooseKey("currentQuery");
|
|
10
|
-
var _currentQueryInitialState = /*#__PURE__*/_classPrivateFieldLooseKey("currentQueryInitialState");
|
|
11
|
-
var _currentResult = /*#__PURE__*/_classPrivateFieldLooseKey("currentResult");
|
|
12
|
-
var _currentResultState = /*#__PURE__*/_classPrivateFieldLooseKey("currentResultState");
|
|
13
|
-
var _currentResultOptions = /*#__PURE__*/_classPrivateFieldLooseKey("currentResultOptions");
|
|
14
|
-
var _selectError = /*#__PURE__*/_classPrivateFieldLooseKey("selectError");
|
|
15
|
-
var _selectFn = /*#__PURE__*/_classPrivateFieldLooseKey("selectFn");
|
|
16
|
-
var _selectResult = /*#__PURE__*/_classPrivateFieldLooseKey("selectResult");
|
|
17
|
-
var _lastQueryWithDefinedData = /*#__PURE__*/_classPrivateFieldLooseKey("lastQueryWithDefinedData");
|
|
18
|
-
var _staleTimeoutId = /*#__PURE__*/_classPrivateFieldLooseKey("staleTimeoutId");
|
|
19
|
-
var _refetchIntervalId = /*#__PURE__*/_classPrivateFieldLooseKey("refetchIntervalId");
|
|
20
|
-
var _currentRefetchInterval = /*#__PURE__*/_classPrivateFieldLooseKey("currentRefetchInterval");
|
|
21
|
-
var _trackedProps = /*#__PURE__*/_classPrivateFieldLooseKey("trackedProps");
|
|
22
|
-
var _executeFetch = /*#__PURE__*/_classPrivateFieldLooseKey("executeFetch");
|
|
23
|
-
var _updateStaleTimeout = /*#__PURE__*/_classPrivateFieldLooseKey("updateStaleTimeout");
|
|
24
|
-
var _computeRefetchInterval = /*#__PURE__*/_classPrivateFieldLooseKey("computeRefetchInterval");
|
|
25
|
-
var _updateRefetchInterval = /*#__PURE__*/_classPrivateFieldLooseKey("updateRefetchInterval");
|
|
26
|
-
var _updateTimers = /*#__PURE__*/_classPrivateFieldLooseKey("updateTimers");
|
|
27
|
-
var _clearStaleTimeout = /*#__PURE__*/_classPrivateFieldLooseKey("clearStaleTimeout");
|
|
28
|
-
var _clearRefetchInterval = /*#__PURE__*/_classPrivateFieldLooseKey("clearRefetchInterval");
|
|
29
|
-
var _updateResult = /*#__PURE__*/_classPrivateFieldLooseKey("updateResult");
|
|
30
|
-
var _updateQuery = /*#__PURE__*/_classPrivateFieldLooseKey("updateQuery");
|
|
31
|
-
var _notify = /*#__PURE__*/_classPrivateFieldLooseKey("notify");
|
|
32
|
-
class QueryObserver extends Subscribable {
|
|
33
|
-
constructor(client, options) {
|
|
34
|
-
super();
|
|
35
|
-
Object.defineProperty(this, _notify, {
|
|
36
|
-
value: _notify2
|
|
37
|
-
});
|
|
38
|
-
Object.defineProperty(this, _updateQuery, {
|
|
39
|
-
value: _updateQuery2
|
|
40
|
-
});
|
|
41
|
-
Object.defineProperty(this, _updateResult, {
|
|
42
|
-
value: _updateResult2
|
|
43
|
-
});
|
|
44
|
-
Object.defineProperty(this, _clearRefetchInterval, {
|
|
45
|
-
value: _clearRefetchInterval2
|
|
46
|
-
});
|
|
47
|
-
Object.defineProperty(this, _clearStaleTimeout, {
|
|
48
|
-
value: _clearStaleTimeout2
|
|
49
|
-
});
|
|
50
|
-
Object.defineProperty(this, _updateTimers, {
|
|
51
|
-
value: _updateTimers2
|
|
52
|
-
});
|
|
53
|
-
Object.defineProperty(this, _updateRefetchInterval, {
|
|
54
|
-
value: _updateRefetchInterval2
|
|
55
|
-
});
|
|
56
|
-
Object.defineProperty(this, _computeRefetchInterval, {
|
|
57
|
-
value: _computeRefetchInterval2
|
|
58
|
-
});
|
|
59
|
-
Object.defineProperty(this, _updateStaleTimeout, {
|
|
60
|
-
value: _updateStaleTimeout2
|
|
61
|
-
});
|
|
62
|
-
Object.defineProperty(this, _executeFetch, {
|
|
63
|
-
value: _executeFetch2
|
|
64
|
-
});
|
|
65
|
-
Object.defineProperty(this, _client, {
|
|
66
|
-
writable: true,
|
|
67
|
-
value: void 0
|
|
68
|
-
});
|
|
69
|
-
Object.defineProperty(this, _currentQuery, {
|
|
70
|
-
writable: true,
|
|
71
|
-
value: undefined
|
|
72
|
-
});
|
|
73
|
-
Object.defineProperty(this, _currentQueryInitialState, {
|
|
74
|
-
writable: true,
|
|
75
|
-
value: undefined
|
|
76
|
-
});
|
|
77
|
-
Object.defineProperty(this, _currentResult, {
|
|
78
|
-
writable: true,
|
|
79
|
-
value: undefined
|
|
80
|
-
});
|
|
81
|
-
Object.defineProperty(this, _currentResultState, {
|
|
82
|
-
writable: true,
|
|
83
|
-
value: void 0
|
|
84
|
-
});
|
|
85
|
-
Object.defineProperty(this, _currentResultOptions, {
|
|
86
|
-
writable: true,
|
|
87
|
-
value: void 0
|
|
88
|
-
});
|
|
89
|
-
Object.defineProperty(this, _selectError, {
|
|
90
|
-
writable: true,
|
|
91
|
-
value: void 0
|
|
92
|
-
});
|
|
93
|
-
Object.defineProperty(this, _selectFn, {
|
|
94
|
-
writable: true,
|
|
95
|
-
value: void 0
|
|
96
|
-
});
|
|
97
|
-
Object.defineProperty(this, _selectResult, {
|
|
98
|
-
writable: true,
|
|
99
|
-
value: void 0
|
|
100
|
-
});
|
|
101
|
-
// This property keeps track of the last query with defined data.
|
|
102
|
-
// It will be used to pass the previous data and query to the placeholder function between renders.
|
|
103
|
-
Object.defineProperty(this, _lastQueryWithDefinedData, {
|
|
104
|
-
writable: true,
|
|
105
|
-
value: void 0
|
|
106
|
-
});
|
|
107
|
-
Object.defineProperty(this, _staleTimeoutId, {
|
|
108
|
-
writable: true,
|
|
109
|
-
value: void 0
|
|
110
|
-
});
|
|
111
|
-
Object.defineProperty(this, _refetchIntervalId, {
|
|
112
|
-
writable: true,
|
|
113
|
-
value: void 0
|
|
114
|
-
});
|
|
115
|
-
Object.defineProperty(this, _currentRefetchInterval, {
|
|
116
|
-
writable: true,
|
|
117
|
-
value: void 0
|
|
118
|
-
});
|
|
119
|
-
Object.defineProperty(this, _trackedProps, {
|
|
120
|
-
writable: true,
|
|
121
|
-
value: new Set()
|
|
122
|
-
});
|
|
123
|
-
_classPrivateFieldLooseBase(this, _client)[_client] = client;
|
|
124
|
-
this.options = options;
|
|
125
|
-
_classPrivateFieldLooseBase(this, _selectError)[_selectError] = null;
|
|
126
|
-
this.bindMethods();
|
|
127
|
-
this.setOptions(options);
|
|
128
|
-
}
|
|
129
|
-
bindMethods() {
|
|
130
|
-
this.refetch = this.refetch.bind(this);
|
|
131
|
-
}
|
|
132
|
-
onSubscribe() {
|
|
133
|
-
if (this.listeners.size === 1) {
|
|
134
|
-
_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery].addObserver(this);
|
|
135
|
-
if (shouldFetchOnMount(_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery], this.options)) {
|
|
136
|
-
_classPrivateFieldLooseBase(this, _executeFetch)[_executeFetch]();
|
|
137
|
-
}
|
|
138
|
-
_classPrivateFieldLooseBase(this, _updateTimers)[_updateTimers]();
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
onUnsubscribe() {
|
|
142
|
-
if (!this.hasListeners()) {
|
|
143
|
-
this.destroy();
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
shouldFetchOnReconnect() {
|
|
147
|
-
return shouldFetchOn(_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery], this.options, this.options.refetchOnReconnect);
|
|
148
|
-
}
|
|
149
|
-
shouldFetchOnWindowFocus() {
|
|
150
|
-
return shouldFetchOn(_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery], this.options, this.options.refetchOnWindowFocus);
|
|
151
|
-
}
|
|
152
|
-
destroy() {
|
|
153
|
-
this.listeners = new Set();
|
|
154
|
-
_classPrivateFieldLooseBase(this, _clearStaleTimeout)[_clearStaleTimeout]();
|
|
155
|
-
_classPrivateFieldLooseBase(this, _clearRefetchInterval)[_clearRefetchInterval]();
|
|
156
|
-
_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery].removeObserver(this);
|
|
157
|
-
}
|
|
158
|
-
setOptions(options, notifyOptions) {
|
|
159
|
-
const prevOptions = this.options;
|
|
160
|
-
const prevQuery = _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery];
|
|
161
|
-
this.options = _classPrivateFieldLooseBase(this, _client)[_client].defaultQueryOptions(options);
|
|
162
|
-
if (!shallowEqualObjects(prevOptions, this.options)) {
|
|
163
|
-
_classPrivateFieldLooseBase(this, _client)[_client].getQueryCache().notify({
|
|
164
|
-
type: 'observerOptionsUpdated',
|
|
165
|
-
query: _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery],
|
|
166
|
-
observer: this
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
if (typeof this.options.enabled !== 'undefined' && typeof this.options.enabled !== 'boolean') {
|
|
170
|
-
throw new Error('Expected enabled to be a boolean');
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
// Keep previous query key if the user does not supply one
|
|
174
|
-
if (!this.options.queryKey) {
|
|
175
|
-
this.options.queryKey = prevOptions.queryKey;
|
|
176
|
-
}
|
|
177
|
-
_classPrivateFieldLooseBase(this, _updateQuery)[_updateQuery]();
|
|
178
|
-
const mounted = this.hasListeners();
|
|
179
|
-
|
|
180
|
-
// Fetch if there are subscribers
|
|
181
|
-
if (mounted && shouldFetchOptionally(_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery], prevQuery, this.options, prevOptions)) {
|
|
182
|
-
_classPrivateFieldLooseBase(this, _executeFetch)[_executeFetch]();
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// Update result
|
|
186
|
-
_classPrivateFieldLooseBase(this, _updateResult)[_updateResult](notifyOptions);
|
|
187
|
-
|
|
188
|
-
// Update stale interval if needed
|
|
189
|
-
if (mounted && (_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery] !== prevQuery || this.options.enabled !== prevOptions.enabled || this.options.staleTime !== prevOptions.staleTime)) {
|
|
190
|
-
_classPrivateFieldLooseBase(this, _updateStaleTimeout)[_updateStaleTimeout]();
|
|
191
|
-
}
|
|
192
|
-
const nextRefetchInterval = _classPrivateFieldLooseBase(this, _computeRefetchInterval)[_computeRefetchInterval]();
|
|
193
|
-
|
|
194
|
-
// Update refetch interval if needed
|
|
195
|
-
if (mounted && (_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery] !== prevQuery || this.options.enabled !== prevOptions.enabled || nextRefetchInterval !== _classPrivateFieldLooseBase(this, _currentRefetchInterval)[_currentRefetchInterval])) {
|
|
196
|
-
_classPrivateFieldLooseBase(this, _updateRefetchInterval)[_updateRefetchInterval](nextRefetchInterval);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
getOptimisticResult(options) {
|
|
200
|
-
const query = _classPrivateFieldLooseBase(this, _client)[_client].getQueryCache().build(_classPrivateFieldLooseBase(this, _client)[_client], options);
|
|
201
|
-
return this.createResult(query, options);
|
|
202
|
-
}
|
|
203
|
-
getCurrentResult() {
|
|
204
|
-
return _classPrivateFieldLooseBase(this, _currentResult)[_currentResult];
|
|
205
|
-
}
|
|
206
|
-
trackResult(result) {
|
|
207
|
-
const trackedResult = {};
|
|
208
|
-
Object.keys(result).forEach(key => {
|
|
209
|
-
Object.defineProperty(trackedResult, key, {
|
|
210
|
-
configurable: false,
|
|
211
|
-
enumerable: true,
|
|
212
|
-
get: () => {
|
|
213
|
-
_classPrivateFieldLooseBase(this, _trackedProps)[_trackedProps].add(key);
|
|
214
|
-
return result[key];
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
});
|
|
218
|
-
return trackedResult;
|
|
219
|
-
}
|
|
220
|
-
getCurrentQuery() {
|
|
221
|
-
return _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery];
|
|
222
|
-
}
|
|
223
|
-
refetch({
|
|
224
|
-
...options
|
|
225
|
-
} = {}) {
|
|
226
|
-
return this.fetch({
|
|
227
|
-
...options
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
fetchOptimistic(options) {
|
|
231
|
-
const defaultedOptions = _classPrivateFieldLooseBase(this, _client)[_client].defaultQueryOptions(options);
|
|
232
|
-
const query = _classPrivateFieldLooseBase(this, _client)[_client].getQueryCache().build(_classPrivateFieldLooseBase(this, _client)[_client], defaultedOptions);
|
|
233
|
-
query.isFetchingOptimistic = true;
|
|
234
|
-
return query.fetch().then(() => this.createResult(query, defaultedOptions));
|
|
235
|
-
}
|
|
236
|
-
fetch(fetchOptions) {
|
|
237
|
-
var _fetchOptions$cancelR;
|
|
238
|
-
return _classPrivateFieldLooseBase(this, _executeFetch)[_executeFetch]({
|
|
239
|
-
...fetchOptions,
|
|
240
|
-
cancelRefetch: (_fetchOptions$cancelR = fetchOptions.cancelRefetch) != null ? _fetchOptions$cancelR : true
|
|
241
|
-
}).then(() => {
|
|
242
|
-
_classPrivateFieldLooseBase(this, _updateResult)[_updateResult]();
|
|
243
|
-
return _classPrivateFieldLooseBase(this, _currentResult)[_currentResult];
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
createResult(query, options) {
|
|
247
|
-
const prevQuery = _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery];
|
|
248
|
-
const prevOptions = this.options;
|
|
249
|
-
const prevResult = _classPrivateFieldLooseBase(this, _currentResult)[_currentResult];
|
|
250
|
-
const prevResultState = _classPrivateFieldLooseBase(this, _currentResultState)[_currentResultState];
|
|
251
|
-
const prevResultOptions = _classPrivateFieldLooseBase(this, _currentResultOptions)[_currentResultOptions];
|
|
252
|
-
const queryChange = query !== prevQuery;
|
|
253
|
-
const queryInitialState = queryChange ? query.state : _classPrivateFieldLooseBase(this, _currentQueryInitialState)[_currentQueryInitialState];
|
|
254
|
-
const {
|
|
255
|
-
state
|
|
256
|
-
} = query;
|
|
257
|
-
let {
|
|
258
|
-
error,
|
|
259
|
-
errorUpdatedAt,
|
|
260
|
-
fetchStatus,
|
|
261
|
-
status
|
|
262
|
-
} = state;
|
|
263
|
-
let isPlaceholderData = false;
|
|
264
|
-
let data;
|
|
265
|
-
|
|
266
|
-
// Optimistically set result in fetching state if needed
|
|
267
|
-
if (options._optimisticResults) {
|
|
268
|
-
const mounted = this.hasListeners();
|
|
269
|
-
const fetchOnMount = !mounted && shouldFetchOnMount(query, options);
|
|
270
|
-
const fetchOptionally = mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions);
|
|
271
|
-
if (fetchOnMount || fetchOptionally) {
|
|
272
|
-
fetchStatus = canFetch(query.options.networkMode) ? 'fetching' : 'paused';
|
|
273
|
-
if (!state.dataUpdatedAt) {
|
|
274
|
-
status = 'pending';
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
if (options._optimisticResults === 'isRestoring') {
|
|
278
|
-
fetchStatus = 'idle';
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
// Select data if needed
|
|
283
|
-
if (options.select && typeof state.data !== 'undefined') {
|
|
284
|
-
// Memoize select result
|
|
285
|
-
if (prevResult && state.data === (prevResultState == null ? void 0 : prevResultState.data) && options.select === _classPrivateFieldLooseBase(this, _selectFn)[_selectFn]) {
|
|
286
|
-
data = _classPrivateFieldLooseBase(this, _selectResult)[_selectResult];
|
|
287
|
-
} else {
|
|
288
|
-
try {
|
|
289
|
-
_classPrivateFieldLooseBase(this, _selectFn)[_selectFn] = options.select;
|
|
290
|
-
data = options.select(state.data);
|
|
291
|
-
data = replaceData(prevResult == null ? void 0 : prevResult.data, data, options);
|
|
292
|
-
_classPrivateFieldLooseBase(this, _selectResult)[_selectResult] = data;
|
|
293
|
-
_classPrivateFieldLooseBase(this, _selectError)[_selectError] = null;
|
|
294
|
-
} catch (selectError) {
|
|
295
|
-
_classPrivateFieldLooseBase(this, _selectError)[_selectError] = selectError;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
// Use query data
|
|
300
|
-
else {
|
|
301
|
-
data = state.data;
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
// Show placeholder data if needed
|
|
305
|
-
if (typeof options.placeholderData !== 'undefined' && typeof data === 'undefined' && status === 'pending') {
|
|
306
|
-
let placeholderData;
|
|
307
|
-
|
|
308
|
-
// Memoize placeholder data
|
|
309
|
-
if (prevResult != null && prevResult.isPlaceholderData && options.placeholderData === (prevResultOptions == null ? void 0 : prevResultOptions.placeholderData)) {
|
|
310
|
-
placeholderData = prevResult.data;
|
|
311
|
-
} else {
|
|
312
|
-
var _classPrivateFieldLoo;
|
|
313
|
-
placeholderData = typeof options.placeholderData === 'function' ? options.placeholderData((_classPrivateFieldLoo = _classPrivateFieldLooseBase(this, _lastQueryWithDefinedData)[_lastQueryWithDefinedData]) == null ? void 0 : _classPrivateFieldLoo.state.data, _classPrivateFieldLooseBase(this, _lastQueryWithDefinedData)[_lastQueryWithDefinedData]) : options.placeholderData;
|
|
314
|
-
if (options.select && typeof placeholderData !== 'undefined') {
|
|
315
|
-
try {
|
|
316
|
-
placeholderData = options.select(placeholderData);
|
|
317
|
-
_classPrivateFieldLooseBase(this, _selectError)[_selectError] = null;
|
|
318
|
-
} catch (selectError) {
|
|
319
|
-
_classPrivateFieldLooseBase(this, _selectError)[_selectError] = selectError;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
if (typeof placeholderData !== 'undefined') {
|
|
324
|
-
status = 'success';
|
|
325
|
-
data = replaceData(prevResult == null ? void 0 : prevResult.data, placeholderData, options);
|
|
326
|
-
isPlaceholderData = true;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
if (_classPrivateFieldLooseBase(this, _selectError)[_selectError]) {
|
|
330
|
-
error = _classPrivateFieldLooseBase(this, _selectError)[_selectError];
|
|
331
|
-
data = _classPrivateFieldLooseBase(this, _selectResult)[_selectResult];
|
|
332
|
-
errorUpdatedAt = Date.now();
|
|
333
|
-
status = 'error';
|
|
334
|
-
}
|
|
335
|
-
const isFetching = fetchStatus === 'fetching';
|
|
336
|
-
const isPending = status === 'pending';
|
|
337
|
-
const isError = status === 'error';
|
|
338
|
-
const isLoading = isPending && isFetching;
|
|
339
|
-
const result = {
|
|
340
|
-
status,
|
|
341
|
-
fetchStatus,
|
|
342
|
-
isPending,
|
|
343
|
-
isSuccess: status === 'success',
|
|
344
|
-
isError,
|
|
345
|
-
isInitialLoading: isLoading,
|
|
346
|
-
isLoading,
|
|
347
|
-
data,
|
|
348
|
-
dataUpdatedAt: state.dataUpdatedAt,
|
|
349
|
-
error,
|
|
350
|
-
errorUpdatedAt,
|
|
351
|
-
failureCount: state.fetchFailureCount,
|
|
352
|
-
failureReason: state.fetchFailureReason,
|
|
353
|
-
errorUpdateCount: state.errorUpdateCount,
|
|
354
|
-
isFetched: state.dataUpdateCount > 0 || state.errorUpdateCount > 0,
|
|
355
|
-
isFetchedAfterMount: state.dataUpdateCount > queryInitialState.dataUpdateCount || state.errorUpdateCount > queryInitialState.errorUpdateCount,
|
|
356
|
-
isFetching,
|
|
357
|
-
isRefetching: isFetching && !isPending,
|
|
358
|
-
isLoadingError: isError && state.dataUpdatedAt === 0,
|
|
359
|
-
isPaused: fetchStatus === 'paused',
|
|
360
|
-
isPlaceholderData,
|
|
361
|
-
isRefetchError: isError && state.dataUpdatedAt !== 0,
|
|
362
|
-
isStale: isStale(query, options),
|
|
363
|
-
refetch: this.refetch
|
|
364
|
-
};
|
|
365
|
-
return result;
|
|
366
|
-
}
|
|
367
|
-
onQueryUpdate() {
|
|
368
|
-
_classPrivateFieldLooseBase(this, _updateResult)[_updateResult]();
|
|
369
|
-
if (this.hasListeners()) {
|
|
370
|
-
_classPrivateFieldLooseBase(this, _updateTimers)[_updateTimers]();
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
function _executeFetch2(fetchOptions) {
|
|
375
|
-
// Make sure we reference the latest query as the current one might have been removed
|
|
376
|
-
_classPrivateFieldLooseBase(this, _updateQuery)[_updateQuery]();
|
|
377
|
-
|
|
378
|
-
// Fetch
|
|
379
|
-
let promise = _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery].fetch(this.options, fetchOptions);
|
|
380
|
-
if (!(fetchOptions != null && fetchOptions.throwOnError)) {
|
|
381
|
-
promise = promise.catch(noop);
|
|
382
|
-
}
|
|
383
|
-
return promise;
|
|
384
|
-
}
|
|
385
|
-
function _updateStaleTimeout2() {
|
|
386
|
-
_classPrivateFieldLooseBase(this, _clearStaleTimeout)[_clearStaleTimeout]();
|
|
387
|
-
if (isServer || _classPrivateFieldLooseBase(this, _currentResult)[_currentResult].isStale || !isValidTimeout(this.options.staleTime)) {
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
const time = timeUntilStale(_classPrivateFieldLooseBase(this, _currentResult)[_currentResult].dataUpdatedAt, this.options.staleTime);
|
|
391
|
-
|
|
392
|
-
// The timeout is sometimes triggered 1 ms before the stale time expiration.
|
|
393
|
-
// To mitigate this issue we always add 1 ms to the timeout.
|
|
394
|
-
const timeout = time + 1;
|
|
395
|
-
_classPrivateFieldLooseBase(this, _staleTimeoutId)[_staleTimeoutId] = setTimeout(() => {
|
|
396
|
-
if (!_classPrivateFieldLooseBase(this, _currentResult)[_currentResult].isStale) {
|
|
397
|
-
_classPrivateFieldLooseBase(this, _updateResult)[_updateResult]();
|
|
398
|
-
}
|
|
399
|
-
}, timeout);
|
|
400
|
-
}
|
|
401
|
-
function _computeRefetchInterval2() {
|
|
402
|
-
var _ref;
|
|
403
|
-
return (_ref = typeof this.options.refetchInterval === 'function' ? this.options.refetchInterval(_classPrivateFieldLooseBase(this, _currentResult)[_currentResult].data, _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery]) : this.options.refetchInterval) != null ? _ref : false;
|
|
404
|
-
}
|
|
405
|
-
function _updateRefetchInterval2(nextInterval) {
|
|
406
|
-
_classPrivateFieldLooseBase(this, _clearRefetchInterval)[_clearRefetchInterval]();
|
|
407
|
-
_classPrivateFieldLooseBase(this, _currentRefetchInterval)[_currentRefetchInterval] = nextInterval;
|
|
408
|
-
if (isServer || this.options.enabled === false || !isValidTimeout(_classPrivateFieldLooseBase(this, _currentRefetchInterval)[_currentRefetchInterval]) || _classPrivateFieldLooseBase(this, _currentRefetchInterval)[_currentRefetchInterval] === 0) {
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
|
-
_classPrivateFieldLooseBase(this, _refetchIntervalId)[_refetchIntervalId] = setInterval(() => {
|
|
412
|
-
if (this.options.refetchIntervalInBackground || focusManager.isFocused()) {
|
|
413
|
-
_classPrivateFieldLooseBase(this, _executeFetch)[_executeFetch]();
|
|
414
|
-
}
|
|
415
|
-
}, _classPrivateFieldLooseBase(this, _currentRefetchInterval)[_currentRefetchInterval]);
|
|
416
|
-
}
|
|
417
|
-
function _updateTimers2() {
|
|
418
|
-
_classPrivateFieldLooseBase(this, _updateStaleTimeout)[_updateStaleTimeout]();
|
|
419
|
-
_classPrivateFieldLooseBase(this, _updateRefetchInterval)[_updateRefetchInterval](_classPrivateFieldLooseBase(this, _computeRefetchInterval)[_computeRefetchInterval]());
|
|
420
|
-
}
|
|
421
|
-
function _clearStaleTimeout2() {
|
|
422
|
-
if (_classPrivateFieldLooseBase(this, _staleTimeoutId)[_staleTimeoutId]) {
|
|
423
|
-
clearTimeout(_classPrivateFieldLooseBase(this, _staleTimeoutId)[_staleTimeoutId]);
|
|
424
|
-
_classPrivateFieldLooseBase(this, _staleTimeoutId)[_staleTimeoutId] = undefined;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
function _clearRefetchInterval2() {
|
|
428
|
-
if (_classPrivateFieldLooseBase(this, _refetchIntervalId)[_refetchIntervalId]) {
|
|
429
|
-
clearInterval(_classPrivateFieldLooseBase(this, _refetchIntervalId)[_refetchIntervalId]);
|
|
430
|
-
_classPrivateFieldLooseBase(this, _refetchIntervalId)[_refetchIntervalId] = undefined;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
function _updateResult2(notifyOptions) {
|
|
434
|
-
const prevResult = _classPrivateFieldLooseBase(this, _currentResult)[_currentResult];
|
|
435
|
-
const nextResult = this.createResult(_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery], this.options);
|
|
436
|
-
_classPrivateFieldLooseBase(this, _currentResultState)[_currentResultState] = _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery].state;
|
|
437
|
-
_classPrivateFieldLooseBase(this, _currentResultOptions)[_currentResultOptions] = this.options;
|
|
438
|
-
|
|
439
|
-
// Only notify and update result if something has changed
|
|
440
|
-
if (shallowEqualObjects(nextResult, prevResult)) {
|
|
441
|
-
return;
|
|
442
|
-
}
|
|
443
|
-
if (_classPrivateFieldLooseBase(this, _currentResultState)[_currentResultState].data !== undefined) {
|
|
444
|
-
_classPrivateFieldLooseBase(this, _lastQueryWithDefinedData)[_lastQueryWithDefinedData] = _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery];
|
|
445
|
-
}
|
|
446
|
-
_classPrivateFieldLooseBase(this, _currentResult)[_currentResult] = nextResult;
|
|
447
|
-
|
|
448
|
-
// Determine which callbacks to trigger
|
|
449
|
-
const defaultNotifyOptions = {};
|
|
450
|
-
const shouldNotifyListeners = () => {
|
|
451
|
-
if (!prevResult) {
|
|
452
|
-
return true;
|
|
453
|
-
}
|
|
454
|
-
const {
|
|
455
|
-
notifyOnChangeProps
|
|
456
|
-
} = this.options;
|
|
457
|
-
if (notifyOnChangeProps === 'all' || !notifyOnChangeProps && !_classPrivateFieldLooseBase(this, _trackedProps)[_trackedProps].size) {
|
|
458
|
-
return true;
|
|
459
|
-
}
|
|
460
|
-
const includedProps = new Set(notifyOnChangeProps != null ? notifyOnChangeProps : _classPrivateFieldLooseBase(this, _trackedProps)[_trackedProps]);
|
|
461
|
-
if (this.options.throwOnError) {
|
|
462
|
-
includedProps.add('error');
|
|
463
|
-
}
|
|
464
|
-
return Object.keys(_classPrivateFieldLooseBase(this, _currentResult)[_currentResult]).some(key => {
|
|
465
|
-
const typedKey = key;
|
|
466
|
-
const changed = _classPrivateFieldLooseBase(this, _currentResult)[_currentResult][typedKey] !== prevResult[typedKey];
|
|
467
|
-
return changed && includedProps.has(typedKey);
|
|
468
|
-
});
|
|
469
|
-
};
|
|
470
|
-
if ((notifyOptions == null ? void 0 : notifyOptions.listeners) !== false && shouldNotifyListeners()) {
|
|
471
|
-
defaultNotifyOptions.listeners = true;
|
|
472
|
-
}
|
|
473
|
-
_classPrivateFieldLooseBase(this, _notify)[_notify]({
|
|
474
|
-
...defaultNotifyOptions,
|
|
475
|
-
...notifyOptions
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
function _updateQuery2() {
|
|
479
|
-
const query = _classPrivateFieldLooseBase(this, _client)[_client].getQueryCache().build(_classPrivateFieldLooseBase(this, _client)[_client], this.options);
|
|
480
|
-
if (query === _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery]) {
|
|
481
|
-
return;
|
|
482
|
-
}
|
|
483
|
-
const prevQuery = _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery];
|
|
484
|
-
_classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery] = query;
|
|
485
|
-
_classPrivateFieldLooseBase(this, _currentQueryInitialState)[_currentQueryInitialState] = query.state;
|
|
486
|
-
if (this.hasListeners()) {
|
|
487
|
-
prevQuery == null ? void 0 : prevQuery.removeObserver(this);
|
|
488
|
-
query.addObserver(this);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
function _notify2(notifyOptions) {
|
|
492
|
-
notifyManager.batch(() => {
|
|
493
|
-
// First, trigger the listeners
|
|
494
|
-
if (notifyOptions.listeners) {
|
|
495
|
-
this.listeners.forEach(listener => {
|
|
496
|
-
listener(_classPrivateFieldLooseBase(this, _currentResult)[_currentResult]);
|
|
497
|
-
});
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
// Then the cache listeners
|
|
501
|
-
_classPrivateFieldLooseBase(this, _client)[_client].getQueryCache().notify({
|
|
502
|
-
query: _classPrivateFieldLooseBase(this, _currentQuery)[_currentQuery],
|
|
503
|
-
type: 'observerResultsUpdated'
|
|
504
|
-
});
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
function shouldLoadOnMount(query, options) {
|
|
508
|
-
return options.enabled !== false && !query.state.dataUpdatedAt && !(query.state.status === 'error' && options.retryOnMount === false);
|
|
509
|
-
}
|
|
510
|
-
function shouldFetchOnMount(query, options) {
|
|
511
|
-
return shouldLoadOnMount(query, options) || query.state.dataUpdatedAt > 0 && shouldFetchOn(query, options, options.refetchOnMount);
|
|
512
|
-
}
|
|
513
|
-
function shouldFetchOn(query, options, field) {
|
|
514
|
-
if (options.enabled !== false) {
|
|
515
|
-
const value = typeof field === 'function' ? field(query) : field;
|
|
516
|
-
return value === 'always' || value !== false && isStale(query, options);
|
|
517
|
-
}
|
|
518
|
-
return false;
|
|
519
|
-
}
|
|
520
|
-
function shouldFetchOptionally(query, prevQuery, options, prevOptions) {
|
|
521
|
-
return options.enabled !== false && (query !== prevQuery || prevOptions.enabled === false) && (!options.suspense || query.state.status !== 'error') && isStale(query, options);
|
|
522
|
-
}
|
|
523
|
-
function isStale(query, options) {
|
|
524
|
-
return query.isStaleByTime(options.staleTime);
|
|
525
|
-
}
|
|
526
|
-
|
|
527
|
-
export { QueryObserver };
|
|
528
|
-
//# sourceMappingURL=queryObserver.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queryObserver.esm.js","sources":["../../src/queryObserver.ts"],"sourcesContent":["import type {\n DefaultedQueryObserverOptions,\n DefaultError,\n PlaceholderDataFunction,\n QueryKey,\n QueryObserverBaseResult,\n QueryObserverOptions,\n QueryObserverResult,\n QueryOptions,\n RefetchOptions,\n} from './types'\nimport {\n isServer,\n isValidTimeout,\n noop,\n replaceData,\n shallowEqualObjects,\n timeUntilStale,\n} from './utils'\nimport { notifyManager } from './notifyManager'\nimport type { Query, QueryState, FetchOptions } from './query'\nimport type { QueryClient } from './queryClient'\nimport { focusManager } from './focusManager'\nimport { Subscribable } from './subscribable'\nimport { canFetch } from './retryer'\n\ntype QueryObserverListener<TData, TError> = (\n result: QueryObserverResult<TData, TError>,\n) => void\n\nexport interface NotifyOptions {\n listeners?: boolean\n}\n\nexport interface ObserverFetchOptions extends FetchOptions {\n throwOnError?: boolean\n}\n\nexport class QueryObserver<\n TQueryFnData = unknown,\n TError = DefaultError,\n TData = TQueryFnData,\n TQueryData = TQueryFnData,\n TQueryKey extends QueryKey = QueryKey,\n> extends Subscribable<QueryObserverListener<TData, TError>> {\n options: QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n\n #client: QueryClient\n #currentQuery: Query<TQueryFnData, TError, TQueryData, TQueryKey> = undefined!\n #currentQueryInitialState: QueryState<TQueryData, TError> = undefined!\n #currentResult: QueryObserverResult<TData, TError> = undefined!\n #currentResultState?: QueryState<TQueryData, TError>\n #currentResultOptions?: QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >\n #selectError: TError | null\n #selectFn?: (data: TQueryData) => TData\n #selectResult?: TData\n // This property keeps track of the last query with defined data.\n // It will be used to pass the previous data and query to the placeholder function between renders.\n #lastQueryWithDefinedData?: Query<TQueryFnData, TError, TQueryData, TQueryKey>\n #staleTimeoutId?: ReturnType<typeof setTimeout>\n #refetchIntervalId?: ReturnType<typeof setInterval>\n #currentRefetchInterval?: number | false\n #trackedProps: Set<keyof QueryObserverResult> = new Set()\n\n constructor(\n client: QueryClient,\n options: QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n ) {\n super()\n\n this.#client = client\n this.options = options\n this.#selectError = null\n this.bindMethods()\n this.setOptions(options)\n }\n\n protected bindMethods(): void {\n this.refetch = this.refetch.bind(this)\n }\n\n protected onSubscribe(): void {\n if (this.listeners.size === 1) {\n this.#currentQuery.addObserver(this)\n\n if (shouldFetchOnMount(this.#currentQuery, this.options)) {\n this.#executeFetch()\n }\n\n this.#updateTimers()\n }\n }\n\n protected onUnsubscribe(): void {\n if (!this.hasListeners()) {\n this.destroy()\n }\n }\n\n shouldFetchOnReconnect(): boolean {\n return shouldFetchOn(\n this.#currentQuery,\n this.options,\n this.options.refetchOnReconnect,\n )\n }\n\n shouldFetchOnWindowFocus(): boolean {\n return shouldFetchOn(\n this.#currentQuery,\n this.options,\n this.options.refetchOnWindowFocus,\n )\n }\n\n destroy(): void {\n this.listeners = new Set()\n this.#clearStaleTimeout()\n this.#clearRefetchInterval()\n this.#currentQuery.removeObserver(this)\n }\n\n setOptions(\n options?: QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n notifyOptions?: NotifyOptions,\n ): void {\n const prevOptions = this.options\n const prevQuery = this.#currentQuery\n\n this.options = this.#client.defaultQueryOptions(options)\n\n if (!shallowEqualObjects(prevOptions, this.options)) {\n this.#client.getQueryCache().notify({\n type: 'observerOptionsUpdated',\n query: this.#currentQuery,\n observer: this,\n })\n }\n\n if (\n typeof this.options.enabled !== 'undefined' &&\n typeof this.options.enabled !== 'boolean'\n ) {\n throw new Error('Expected enabled to be a boolean')\n }\n\n // Keep previous query key if the user does not supply one\n if (!this.options.queryKey) {\n this.options.queryKey = prevOptions.queryKey\n }\n\n this.#updateQuery()\n\n const mounted = this.hasListeners()\n\n // Fetch if there are subscribers\n if (\n mounted &&\n shouldFetchOptionally(\n this.#currentQuery,\n prevQuery,\n this.options,\n prevOptions,\n )\n ) {\n this.#executeFetch()\n }\n\n // Update result\n this.#updateResult(notifyOptions)\n\n // Update stale interval if needed\n if (\n mounted &&\n (this.#currentQuery !== prevQuery ||\n this.options.enabled !== prevOptions.enabled ||\n this.options.staleTime !== prevOptions.staleTime)\n ) {\n this.#updateStaleTimeout()\n }\n\n const nextRefetchInterval = this.#computeRefetchInterval()\n\n // Update refetch interval if needed\n if (\n mounted &&\n (this.#currentQuery !== prevQuery ||\n this.options.enabled !== prevOptions.enabled ||\n nextRefetchInterval !== this.#currentRefetchInterval)\n ) {\n this.#updateRefetchInterval(nextRefetchInterval)\n }\n }\n\n getOptimisticResult(\n options: DefaultedQueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n ): QueryObserverResult<TData, TError> {\n const query = this.#client.getQueryCache().build(this.#client, options)\n\n return this.createResult(query, options)\n }\n\n getCurrentResult(): QueryObserverResult<TData, TError> {\n return this.#currentResult\n }\n\n trackResult(\n result: QueryObserverResult<TData, TError>,\n ): QueryObserverResult<TData, TError> {\n const trackedResult = {} as QueryObserverResult<TData, TError>\n\n Object.keys(result).forEach((key) => {\n Object.defineProperty(trackedResult, key, {\n configurable: false,\n enumerable: true,\n get: () => {\n this.#trackedProps.add(key as keyof QueryObserverResult)\n return result[key as keyof QueryObserverResult]\n },\n })\n })\n\n return trackedResult\n }\n\n getCurrentQuery(): Query<TQueryFnData, TError, TQueryData, TQueryKey> {\n return this.#currentQuery\n }\n\n refetch({ ...options }: RefetchOptions = {}): Promise<\n QueryObserverResult<TData, TError>\n > {\n return this.fetch({\n ...options,\n })\n }\n\n fetchOptimistic(\n options: QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n ): Promise<QueryObserverResult<TData, TError>> {\n const defaultedOptions = this.#client.defaultQueryOptions(options)\n\n const query = this.#client\n .getQueryCache()\n .build(this.#client, defaultedOptions)\n query.isFetchingOptimistic = true\n\n return query.fetch().then(() => this.createResult(query, defaultedOptions))\n }\n\n protected fetch(\n fetchOptions: ObserverFetchOptions,\n ): Promise<QueryObserverResult<TData, TError>> {\n return this.#executeFetch({\n ...fetchOptions,\n cancelRefetch: fetchOptions.cancelRefetch ?? true,\n }).then(() => {\n this.#updateResult()\n return this.#currentResult\n })\n }\n\n #executeFetch(\n fetchOptions?: ObserverFetchOptions,\n ): Promise<TQueryData | undefined> {\n // Make sure we reference the latest query as the current one might have been removed\n this.#updateQuery()\n\n // Fetch\n let promise: Promise<TQueryData | undefined> = this.#currentQuery.fetch(\n this.options as QueryOptions<TQueryFnData, TError, TQueryData, TQueryKey>,\n fetchOptions,\n )\n\n if (!fetchOptions?.throwOnError) {\n promise = promise.catch(noop)\n }\n\n return promise\n }\n\n #updateStaleTimeout(): void {\n this.#clearStaleTimeout()\n\n if (\n isServer ||\n this.#currentResult.isStale ||\n !isValidTimeout(this.options.staleTime)\n ) {\n return\n }\n\n const time = timeUntilStale(\n this.#currentResult.dataUpdatedAt,\n this.options.staleTime,\n )\n\n // The timeout is sometimes triggered 1 ms before the stale time expiration.\n // To mitigate this issue we always add 1 ms to the timeout.\n const timeout = time + 1\n\n this.#staleTimeoutId = setTimeout(() => {\n if (!this.#currentResult.isStale) {\n this.#updateResult()\n }\n }, timeout)\n }\n\n #computeRefetchInterval() {\n return (\n (typeof this.options.refetchInterval === 'function'\n ? this.options.refetchInterval(\n this.#currentResult.data,\n this.#currentQuery,\n )\n : this.options.refetchInterval) ?? false\n )\n }\n\n #updateRefetchInterval(nextInterval: number | false): void {\n this.#clearRefetchInterval()\n\n this.#currentRefetchInterval = nextInterval\n\n if (\n isServer ||\n this.options.enabled === false ||\n !isValidTimeout(this.#currentRefetchInterval) ||\n this.#currentRefetchInterval === 0\n ) {\n return\n }\n\n this.#refetchIntervalId = setInterval(() => {\n if (\n this.options.refetchIntervalInBackground ||\n focusManager.isFocused()\n ) {\n this.#executeFetch()\n }\n }, this.#currentRefetchInterval)\n }\n\n #updateTimers(): void {\n this.#updateStaleTimeout()\n this.#updateRefetchInterval(this.#computeRefetchInterval())\n }\n\n #clearStaleTimeout(): void {\n if (this.#staleTimeoutId) {\n clearTimeout(this.#staleTimeoutId)\n this.#staleTimeoutId = undefined\n }\n }\n\n #clearRefetchInterval(): void {\n if (this.#refetchIntervalId) {\n clearInterval(this.#refetchIntervalId)\n this.#refetchIntervalId = undefined\n }\n }\n\n protected createResult(\n query: Query<TQueryFnData, TError, TQueryData, TQueryKey>,\n options: QueryObserverOptions<\n TQueryFnData,\n TError,\n TData,\n TQueryData,\n TQueryKey\n >,\n ): QueryObserverResult<TData, TError> {\n const prevQuery = this.#currentQuery\n const prevOptions = this.options\n const prevResult = this.#currentResult as\n | QueryObserverResult<TData, TError>\n | undefined\n const prevResultState = this.#currentResultState\n const prevResultOptions = this.#currentResultOptions\n const queryChange = query !== prevQuery\n const queryInitialState = queryChange\n ? query.state\n : this.#currentQueryInitialState\n\n const { state } = query\n let { error, errorUpdatedAt, fetchStatus, status } = state\n let isPlaceholderData = false\n let data: TData | undefined\n\n // Optimistically set result in fetching state if needed\n if (options._optimisticResults) {\n const mounted = this.hasListeners()\n\n const fetchOnMount = !mounted && shouldFetchOnMount(query, options)\n\n const fetchOptionally =\n mounted && shouldFetchOptionally(query, prevQuery, options, prevOptions)\n\n if (fetchOnMount || fetchOptionally) {\n fetchStatus = canFetch(query.options.networkMode)\n ? 'fetching'\n : 'paused'\n if (!state.dataUpdatedAt) {\n status = 'pending'\n }\n }\n if (options._optimisticResults === 'isRestoring') {\n fetchStatus = 'idle'\n }\n }\n\n // Select data if needed\n if (options.select && typeof state.data !== 'undefined') {\n // Memoize select result\n if (\n prevResult &&\n state.data === prevResultState?.data &&\n options.select === this.#selectFn\n ) {\n data = this.#selectResult\n } else {\n try {\n this.#selectFn = options.select\n data = options.select(state.data)\n data = replaceData(prevResult?.data, data, options)\n this.#selectResult = data\n this.#selectError = null\n } catch (selectError) {\n this.#selectError = selectError as TError\n }\n }\n }\n // Use query data\n else {\n data = state.data as unknown as TData\n }\n\n // Show placeholder data if needed\n if (\n typeof options.placeholderData !== 'undefined' &&\n typeof data === 'undefined' &&\n status === 'pending'\n ) {\n let placeholderData\n\n // Memoize placeholder data\n if (\n prevResult?.isPlaceholderData &&\n options.placeholderData === prevResultOptions?.placeholderData\n ) {\n placeholderData = prevResult.data\n } else {\n placeholderData =\n typeof options.placeholderData === 'function'\n ? (\n options.placeholderData as unknown as PlaceholderDataFunction<TQueryData>\n )(\n this.#lastQueryWithDefinedData?.state.data,\n this.#lastQueryWithDefinedData as any,\n )\n : options.placeholderData\n if (options.select && typeof placeholderData !== 'undefined') {\n try {\n placeholderData = options.select(placeholderData)\n this.#selectError = null\n } catch (selectError) {\n this.#selectError = selectError as TError\n }\n }\n }\n\n if (typeof placeholderData !== 'undefined') {\n status = 'success'\n data = replaceData(\n prevResult?.data,\n placeholderData as unknown,\n options,\n ) as TData\n isPlaceholderData = true\n }\n }\n\n if (this.#selectError) {\n error = this.#selectError as any\n data = this.#selectResult\n errorUpdatedAt = Date.now()\n status = 'error'\n }\n\n const isFetching = fetchStatus === 'fetching'\n const isPending = status === 'pending'\n const isError = status === 'error'\n\n const isLoading = isPending && isFetching\n\n const result: QueryObserverBaseResult<TData, TError> = {\n status,\n fetchStatus,\n isPending,\n isSuccess: status === 'success',\n isError,\n isInitialLoading: isLoading,\n isLoading,\n data,\n dataUpdatedAt: state.dataUpdatedAt,\n error,\n errorUpdatedAt,\n failureCount: state.fetchFailureCount,\n failureReason: state.fetchFailureReason,\n errorUpdateCount: state.errorUpdateCount,\n isFetched: state.dataUpdateCount > 0 || state.errorUpdateCount > 0,\n isFetchedAfterMount:\n state.dataUpdateCount > queryInitialState.dataUpdateCount ||\n state.errorUpdateCount > queryInitialState.errorUpdateCount,\n isFetching,\n isRefetching: isFetching && !isPending,\n isLoadingError: isError && state.dataUpdatedAt === 0,\n isPaused: fetchStatus === 'paused',\n isPlaceholderData,\n isRefetchError: isError && state.dataUpdatedAt !== 0,\n isStale: isStale(query, options),\n refetch: this.refetch,\n }\n\n return result as QueryObserverResult<TData, TError>\n }\n\n #updateResult(notifyOptions?: NotifyOptions): void {\n const prevResult = this.#currentResult as\n | QueryObserverResult<TData, TError>\n | undefined\n\n const nextResult = this.createResult(this.#currentQuery, this.options)\n this.#currentResultState = this.#currentQuery.state\n this.#currentResultOptions = this.options\n\n // Only notify and update result if something has changed\n if (shallowEqualObjects(nextResult, prevResult)) {\n return\n }\n\n if (this.#currentResultState.data !== undefined) {\n this.#lastQueryWithDefinedData = this.#currentQuery\n }\n this.#currentResult = nextResult\n\n // Determine which callbacks to trigger\n const defaultNotifyOptions: NotifyOptions = {}\n\n const shouldNotifyListeners = (): boolean => {\n if (!prevResult) {\n return true\n }\n\n const { notifyOnChangeProps } = this.options\n\n if (\n notifyOnChangeProps === 'all' ||\n (!notifyOnChangeProps && !this.#trackedProps.size)\n ) {\n return true\n }\n\n const includedProps = new Set(notifyOnChangeProps ?? this.#trackedProps)\n\n if (this.options.throwOnError) {\n includedProps.add('error')\n }\n\n return Object.keys(this.#currentResult).some((key) => {\n const typedKey = key as keyof QueryObserverResult\n const changed = this.#currentResult[typedKey] !== prevResult[typedKey]\n return changed && includedProps.has(typedKey)\n })\n }\n\n if (notifyOptions?.listeners !== false && shouldNotifyListeners()) {\n defaultNotifyOptions.listeners = true\n }\n\n this.#notify({ ...defaultNotifyOptions, ...notifyOptions })\n }\n\n #updateQuery(): void {\n const query = this.#client.getQueryCache().build(this.#client, this.options)\n\n if (query === this.#currentQuery) {\n return\n }\n\n const prevQuery = this.#currentQuery as\n | Query<TQueryFnData, TError, TQueryData, TQueryKey>\n | undefined\n this.#currentQuery = query\n this.#currentQueryInitialState = query.state\n\n if (this.hasListeners()) {\n prevQuery?.removeObserver(this)\n query.addObserver(this)\n }\n }\n\n onQueryUpdate(): void {\n this.#updateResult()\n\n if (this.hasListeners()) {\n this.#updateTimers()\n }\n }\n\n #notify(notifyOptions: NotifyOptions): void {\n notifyManager.batch(() => {\n // First, trigger the listeners\n if (notifyOptions.listeners) {\n this.listeners.forEach((listener) => {\n listener(this.#currentResult)\n })\n }\n\n // Then the cache listeners\n this.#client.getQueryCache().notify({\n query: this.#currentQuery,\n type: 'observerResultsUpdated',\n })\n })\n }\n}\n\nfunction shouldLoadOnMount(\n query: Query<any, any, any, any>,\n options: QueryObserverOptions<any, any, any, any>,\n): boolean {\n return (\n options.enabled !== false &&\n !query.state.dataUpdatedAt &&\n !(query.state.status === 'error' && options.retryOnMount === false)\n )\n}\n\nfunction shouldFetchOnMount(\n query: Query<any, any, any, any>,\n options: QueryObserverOptions<any, any, any, any, any>,\n): boolean {\n return (\n shouldLoadOnMount(query, options) ||\n (query.state.dataUpdatedAt > 0 &&\n shouldFetchOn(query, options, options.refetchOnMount))\n )\n}\n\nfunction shouldFetchOn(\n query: Query<any, any, any, any>,\n options: QueryObserverOptions<any, any, any, any, any>,\n field: (typeof options)['refetchOnMount'] &\n (typeof options)['refetchOnWindowFocus'] &\n (typeof options)['refetchOnReconnect'],\n) {\n if (options.enabled !== false) {\n const value = typeof field === 'function' ? field(query) : field\n\n return value === 'always' || (value !== false && isStale(query, options))\n }\n return false\n}\n\nfunction shouldFetchOptionally(\n query: Query<any, any, any, any>,\n prevQuery: Query<any, any, any, any>,\n options: QueryObserverOptions<any, any, any, any, any>,\n prevOptions: QueryObserverOptions<any, any, any, any, any>,\n): boolean {\n return (\n options.enabled !== false &&\n (query !== prevQuery || prevOptions.enabled === false) &&\n (!options.suspense || query.state.status !== 'error') &&\n isStale(query, options)\n )\n}\n\nfunction isStale(\n query: Query<any, any, any, any>,\n options: QueryObserverOptions<any, any, any, any, any>,\n): boolean {\n return query.isStaleByTime(options.staleTime)\n}\n"],"names":["_client","_classPrivateFieldLooseKey","_currentQuery","_currentQueryInitialState","_currentResult","_currentResultState","_currentResultOptions","_selectError","_selectFn","_selectResult","_lastQueryWithDefinedData","_staleTimeoutId","_refetchIntervalId","_currentRefetchInterval","_trackedProps","_executeFetch","_updateStaleTimeout","_computeRefetchInterval","_updateRefetchInterval","_updateTimers","_clearStaleTimeout","_clearRefetchInterval","_updateResult","_updateQuery","_notify","QueryObserver","Subscribable","constructor","client","options","Object","defineProperty","value","_notify2","_updateQuery2","_updateResult2","_clearRefetchInterval2","_clearStaleTimeout2","_updateTimers2","_updateRefetchInterval2","_computeRefetchInterval2","_updateStaleTimeout2","_executeFetch2","writable","undefined","Set","_classPrivateFieldLooseBase","bindMethods","setOptions","refetch","bind","onSubscribe","listeners","size","addObserver","shouldFetchOnMount","onUnsubscribe","hasListeners","destroy","shouldFetchOnReconnect","shouldFetchOn","refetchOnReconnect","shouldFetchOnWindowFocus","refetchOnWindowFocus","removeObserver","notifyOptions","prevOptions","prevQuery","defaultQueryOptions","shallowEqualObjects","getQueryCache","notify","type","query","observer","enabled","Error","queryKey","mounted","shouldFetchOptionally","staleTime","nextRefetchInterval","getOptimisticResult","build","createResult","getCurrentResult","trackResult","result","trackedResult","keys","forEach","key","configurable","enumerable","get","add","getCurrentQuery","fetch","fetchOptimistic","defaultedOptions","isFetchingOptimistic","then","fetchOptions","_fetchOptions$cancelR","cancelRefetch","prevResult","prevResultState","prevResultOptions","queryChange","queryInitialState","state","error","errorUpdatedAt","fetchStatus","status","isPlaceholderData","data","_optimisticResults","fetchOnMount","fetchOptionally","canFetch","networkMode","dataUpdatedAt","select","replaceData","selectError","placeholderData","_classPrivateFieldLoo","Date","now","isFetching","isPending","isError","isLoading","isSuccess","isInitialLoading","failureCount","fetchFailureCount","failureReason","fetchFailureReason","errorUpdateCount","isFetched","dataUpdateCount","isFetchedAfterMount","isRefetching","isLoadingError","isPaused","isRefetchError","isStale","onQueryUpdate","promise","throwOnError","catch","noop","isServer","isValidTimeout","time","timeUntilStale","timeout","setTimeout","_ref","refetchInterval","nextInterval","setInterval","refetchIntervalInBackground","focusManager","isFocused","clearTimeout","clearInterval","nextResult","defaultNotifyOptions","shouldNotifyListeners","notifyOnChangeProps","includedProps","some","typedKey","changed","has","notifyManager","batch","listener","shouldLoadOnMount","retryOnMount","refetchOnMount","field","suspense","isStaleByTime"],"mappings":";;;;;;;AAwBoC,IAAAA,OAAA,gBAAAC,0BAAA,CAAA,QAAA,CAAA,CAAA;AAAA,IAAAC,aAAA,gBAAAD,0BAAA,CAAA,cAAA,CAAA,CAAA;AAAA,IAAAE,yBAAA,gBAAAF,0BAAA,CAAA,0BAAA,CAAA,CAAA;AAAA,IAAAG,cAAA,gBAAAH,0BAAA,CAAA,eAAA,CAAA,CAAA;AAAA,IAAAI,mBAAA,gBAAAJ,0BAAA,CAAA,oBAAA,CAAA,CAAA;AAAA,IAAAK,qBAAA,gBAAAL,0BAAA,CAAA,sBAAA,CAAA,CAAA;AAAA,IAAAM,YAAA,gBAAAN,0BAAA,CAAA,aAAA,CAAA,CAAA;AAAA,IAAAO,SAAA,gBAAAP,0BAAA,CAAA,UAAA,CAAA,CAAA;AAAA,IAAAQ,aAAA,gBAAAR,0BAAA,CAAA,cAAA,CAAA,CAAA;AAAA,IAAAS,yBAAA,gBAAAT,0BAAA,CAAA,0BAAA,CAAA,CAAA;AAAA,IAAAU,eAAA,gBAAAV,0BAAA,CAAA,gBAAA,CAAA,CAAA;AAAA,IAAAW,kBAAA,gBAAAX,0BAAA,CAAA,mBAAA,CAAA,CAAA;AAAA,IAAAY,uBAAA,gBAAAZ,0BAAA,CAAA,wBAAA,CAAA,CAAA;AAAA,IAAAa,aAAA,gBAAAb,0BAAA,CAAA,cAAA,CAAA,CAAA;AAAA,IAAAc,aAAA,gBAAAd,0BAAA,CAAA,cAAA,CAAA,CAAA;AAAA,IAAAe,mBAAA,gBAAAf,0BAAA,CAAA,oBAAA,CAAA,CAAA;AAAA,IAAAgB,uBAAA,gBAAAhB,0BAAA,CAAA,wBAAA,CAAA,CAAA;AAAA,IAAAiB,sBAAA,gBAAAjB,0BAAA,C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