@astral/mobx-query 1.18.3 → 1.19.0

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.
@@ -31,22 +31,17 @@ export declare class AuxiliaryQuery<TResult, TError = void> {
31
31
  * для устранения гонки запросов
32
32
  */
33
33
  getUnifiedPromise: (executor: Executor<TResult>, onSuccess?: (data: TResult) => void) => Promise<TResult>;
34
- private setSuccess;
35
34
  private checkBackgroundAndSet;
36
35
  /**
37
36
  * Обработчик успешного ответа
38
37
  */
39
38
  submitSuccess: () => void;
40
- private setError;
41
- /**
42
- * Обработчик ошибки
43
- */
44
- submitError: (error: TError) => void;
45
- private setLoading;
39
+ private submitError;
46
40
  /**
47
41
  * Метод, вызываемый в самом начале запроса, чтобы сбросить флаги в соответствующее значение
48
42
  */
49
43
  startLoading: () => void;
44
+ private endLoading;
50
45
  /**
51
46
  * Метод для инвалидации данных
52
47
  */
@@ -38,19 +38,10 @@ export class AuxiliaryQuery {
38
38
  });
39
39
  throw e;
40
40
  })
41
- .finally(() => {
42
- this.unifiedPromise = undefined;
43
- runInAction(() => {
44
- this.statusStorage.isLoading = false;
45
- });
46
- });
41
+ .finally(this.endLoading);
47
42
  }
48
43
  return this.unifiedPromise;
49
44
  };
50
- this.setSuccess = (storage) => {
51
- storage.isError = false;
52
- storage.isSuccess = true;
53
- };
54
45
  this.checkBackgroundAndSet = (setStorage) => {
55
46
  if (this.backgroundStatusStorage && this.statusStorage.isSuccess) {
56
47
  setStorage(this.backgroundStatusStorage);
@@ -63,32 +54,27 @@ export class AuxiliaryQuery {
63
54
  * Обработчик успешного ответа
64
55
  */
65
56
  this.submitSuccess = () => {
66
- this.checkBackgroundAndSet(this.setSuccess);
57
+ this.checkBackgroundAndSet((storage) => storage.setSuccess());
67
58
  this.isInvalid = false;
68
59
  };
69
- this.setError = (storage, error) => {
70
- storage.isSuccess = false;
71
- storage.isError = true;
72
- storage.error = error;
73
- };
74
- /**
75
- * Обработчик ошибки
76
- */
77
60
  this.submitError = (error) => {
78
- this.checkBackgroundAndSet((storage) => this.setError(storage, error));
61
+ this.checkBackgroundAndSet((storage) => storage.setError(error));
79
62
  this.isInvalid = false;
80
63
  };
81
- this.setLoading = (storage) => {
82
- storage.isLoading = true;
83
- storage.isError = false;
84
- storage.isSuccess = false;
85
- };
86
64
  /**
87
65
  * Метод, вызываемый в самом начале запроса, чтобы сбросить флаги в соответствующее значение
88
66
  */
89
67
  this.startLoading = () => {
90
68
  this.isIdle = false;
91
- this.checkBackgroundAndSet(this.setLoading);
69
+ this.checkBackgroundAndSet((storage) => storage.setStartLoading());
70
+ };
71
+ this.endLoading = () => {
72
+ var _a;
73
+ this.unifiedPromise = undefined;
74
+ this.statusStorage.setEndLoading();
75
+ if (this.statusStorage.isSuccess) {
76
+ (_a = this.backgroundStatusStorage) === null || _a === void 0 ? void 0 : _a.setEndLoading();
77
+ }
92
78
  };
93
79
  /**
94
80
  * Метод для инвалидации данных
@@ -101,12 +87,10 @@ export class AuxiliaryQuery {
101
87
  isIdle: observable,
102
88
  isInvalid: observable,
103
89
  submitSuccess: action,
104
- setSuccess: action,
105
- setError: action,
106
- setLoading: action,
107
90
  submitError: action,
108
91
  startLoading: action,
109
92
  invalidate: action,
93
+ endLoading: action,
110
94
  });
111
95
  }
112
96
  }
@@ -1,23 +1,61 @@
1
1
  import { AuxiliaryQuery } from '../AuxiliaryQuery';
2
2
  import { type DataStorage } from '../DataStorage';
3
3
  import { QueryContainer } from '../QueryContainer';
4
- import { type StatusStorage } from '../StatusStorage';
4
+ import { StatusStorage } from '../StatusStorage';
5
5
  import { type FetchPolicy, type QueryBaseActions, type Sync, type SyncParams } from '../types';
6
6
  export declare const DEFAULT_INFINITE_ITEMS_COUNT = 30;
7
- export type InfiniteParams = {
7
+ export type FetchMoreDirection = 'forward' | 'backward';
8
+ export type InfiniteFetchMoreOptions<TResult> = {
9
+ /**
10
+ * Направление для дозапроса данных
11
+ * @default 'forward'
12
+ */
13
+ direction?: FetchMoreDirection;
14
+ /**
15
+ * Колбэк, вызываемый при успешном запросе, подразумевается использование, для запоминания последней успешной позиции
16
+ */
17
+ onSuccess?: (params: {
18
+ offset: number;
19
+ cursor: TResult;
20
+ }) => void;
21
+ };
22
+ export type InfiniteParams<TResult> = {
23
+ /**
24
+ * Смещение, от которого требуется сделать запрос
25
+ * @default 0
26
+ */
8
27
  offset: number;
28
+ /**
29
+ * Количество запрашиваемых элементов
30
+ * @default 30
31
+ */
9
32
  count: number;
33
+ /**
34
+ * Элемент использующийся в качестве точки отсчета при курсорной пагинации.
35
+ * При движении вперед (direction: 'forward') это последний элемент текущего набора данных
36
+ * При движении назад (direction: 'backward') это первый элемент текущего набора данных.
37
+ * Передается в двух случаях:
38
+ * - при использовании fetchMore.
39
+ * - при самом первом запросе, если указан initialCursor.
40
+ * Во всех остальных запросах, включая первый запрос без initialCursor и повторный запрос после invalidate(), cursor будет undefined.
41
+ */
42
+ cursor?: Partial<TResult>;
43
+ /**
44
+ * Направление запроса, присутствует только при использовании fetchMore
45
+ */
46
+ direction?: FetchMoreDirection;
10
47
  };
11
48
  export type InfiniteDataStorage<TResult> = DataStorage<{
12
49
  data: TResult[];
13
50
  offset: number;
14
51
  isEndReached: boolean;
52
+ isStartReached: boolean;
15
53
  }>;
16
54
  /**
17
55
  * Исполнитель запроса, ожидается,
18
56
  * что будет использоваться что-то возвращающее массив данных
19
57
  */
20
- export type InfiniteExecutor<TResult> = (params: InfiniteParams) => Promise<TResult[]>;
58
+ export type InfiniteExecutor<TResult> = (params: InfiniteParams<TResult>) => Promise<TResult[]>;
21
59
  export type InfiniteQueryParams<TResult, TError, TIsBackground extends boolean = false> = {
22
60
  /**
23
61
  * Количество запрашиваемых элементов
@@ -54,6 +92,15 @@ export type InfiniteQueryParams<TResult, TError, TIsBackground extends boolean =
54
92
  * Колбэк, вызываемый при успешном завершении запроса, подразумевается использование, для подтверждения валидности данных, чтобы квери не был удален из памяти
55
93
  */
56
94
  submitValidity?: () => void;
95
+ /**
96
+ * Стартовое значение offset, от которого требуется сделать самый первый запрос.
97
+ * @default 0
98
+ */
99
+ initialOffset?: number;
100
+ /**
101
+ * Стартовый элемент, от которого требуется сделать самый первый запрос
102
+ */
103
+ initialCursor?: Partial<TResult>;
57
104
  };
58
105
  /**
59
106
  * Квери для работы с инфинити запросами,
@@ -85,7 +132,20 @@ export declare class InfiniteQuery<TResult, TError = void, TIsBackground extends
85
132
  * Колбэк, вызываемый при успешном завершении запроса, подразумевается использование, для подтверждения валидности данных, чтобы квери не был удален из памяти
86
133
  */
87
134
  private readonly submitValidity?;
88
- constructor(executor: InfiniteExecutor<TResult>, { incrementCount, onError, enabledAutoFetch, fetchPolicy, dataStorage, statusStorage, backgroundStatusStorage, submitValidity, }: InfiniteQueryParams<TResult, TError, TIsBackground>);
135
+ /**
136
+ * Хранилище статусов для процесса дозапроса данных
137
+ */
138
+ private fetchMoreStatusStorage;
139
+ /**
140
+ * Стартовый offset для запроса,
141
+ */
142
+ private initialOffset;
143
+ /**
144
+ * Стартовое значение курсора, от которого должен произойти первый запрос.
145
+ * Предполагается, что этот элемент должен содержать только id сущности.
146
+ */
147
+ private initialCursor?;
148
+ constructor(executor: InfiniteExecutor<TResult>, { incrementCount, initialOffset, initialCursor, onError, enabledAutoFetch, fetchPolicy, dataStorage, statusStorage, backgroundStatusStorage, submitValidity, }: InfiniteQueryParams<TResult, TError, TIsBackground>);
89
149
  private get isNetworkOnly();
90
150
  /**
91
151
  * Счетчик отступа для инфинити запроса
@@ -99,7 +159,11 @@ export declare class InfiniteQuery<TResult, TError = void, TIsBackground extends
99
159
  * Флаг того, что мы достигли предела запрашиваемых элементов
100
160
  */
101
161
  get isEndReached(): boolean;
102
- private calcIsEndReachedByResult;
162
+ /**
163
+ * Флаг того, что мы достигли самого начала запрашиваемых элементов
164
+ */
165
+ get isStartReached(): boolean;
166
+ private calcIsLimitReachedByResult;
103
167
  /**
104
168
  * Форс метод для установки данных
105
169
  */
@@ -107,15 +171,18 @@ export declare class InfiniteQuery<TResult, TError = void, TIsBackground extends
107
171
  /**
108
172
  * Метод для обогащения параметров текущими значениями для инфинити
109
173
  */
110
- private get infiniteExecutor();
174
+ private makeInfiniteExecutor;
111
175
  /**
112
176
  * Метод для инвалидации данных
113
177
  */
114
178
  invalidate: () => void;
179
+ private setOffset;
180
+ get fetchMoreStatus(): import("../StatusStorage").Statuses<TError>;
115
181
  /**
116
182
  * Метод для запроса следующего набора данных
183
+ * @param options - параметры дозапроса данных
117
184
  */
118
- fetchMore: () => void;
185
+ fetchMore: (options?: InfiniteFetchMoreOptions<TResult>) => void;
119
186
  /**
120
187
  * Синхронный метод получения данных
121
188
  */
@@ -1,28 +1,47 @@
1
1
  import { action, computed, makeObservable, when } from 'mobx';
2
2
  import { AuxiliaryQuery } from '../AuxiliaryQuery';
3
3
  import { QueryContainer } from '../QueryContainer';
4
+ import { StatusStorage } from '../StatusStorage';
4
5
  export const DEFAULT_INFINITE_ITEMS_COUNT = 30;
5
6
  /**
6
7
  * Квери для работы с инфинити запросами,
7
8
  * которые должны быть закешированы,
8
9
  */
9
10
  export class InfiniteQuery extends QueryContainer {
10
- constructor(executor, { incrementCount = DEFAULT_INFINITE_ITEMS_COUNT, onError, enabledAutoFetch, fetchPolicy, dataStorage, statusStorage, backgroundStatusStorage = null, submitValidity, }) {
11
+ constructor(executor, { incrementCount = DEFAULT_INFINITE_ITEMS_COUNT, initialOffset = 0, initialCursor, onError, enabledAutoFetch, fetchPolicy, dataStorage, statusStorage, backgroundStatusStorage = null, submitValidity, }) {
11
12
  super(statusStorage, backgroundStatusStorage, new AuxiliaryQuery(statusStorage, backgroundStatusStorage));
12
13
  this.executor = executor;
14
+ /**
15
+ * Хранилище статусов для процесса дозапроса данных
16
+ */
17
+ this.fetchMoreStatusStorage = new StatusStorage();
18
+ /**
19
+ * Стартовый offset для запроса,
20
+ */
21
+ this.initialOffset = 0;
22
+ /**
23
+ * Стартовое значение курсора, от которого должен произойти первый запрос.
24
+ * Предполагается, что этот элемент должен содержать только id сущности.
25
+ */
26
+ this.initialCursor = undefined;
13
27
  /**
14
28
  * Обработчик успешного запроса, проверяет что мы достигли предела
15
29
  */
16
- this.submitSuccess = (result, isEndReached) => {
30
+ this.submitSuccess = (result, isLimitReached, isBackward) => {
17
31
  var _a;
18
32
  this.storage.setData((current) => ({
19
33
  offset: current === null || current === void 0 ? void 0 : current.offset,
20
34
  data: result,
21
- isEndReached,
35
+ isEndReached: isBackward
36
+ ? Boolean(current === null || current === void 0 ? void 0 : current.isEndReached)
37
+ : isLimitReached,
38
+ isStartReached: isBackward
39
+ ? isLimitReached
40
+ : Boolean(current === null || current === void 0 ? void 0 : current.isStartReached),
22
41
  }));
23
42
  (_a = this.submitValidity) === null || _a === void 0 ? void 0 : _a.call(this);
24
43
  };
25
- this.calcIsEndReachedByResult = (result) => {
44
+ this.calcIsLimitReachedByResult = (result) => {
26
45
  // убеждаемся что результат запроса действительно массив,
27
46
  // и если количество элементов в ответе меньше,
28
47
  // чем запрашивалось, значит у бэка их больше нет,
@@ -47,34 +66,72 @@ export class InfiniteQuery extends QueryContainer {
47
66
  this.submitSuccess(param, this.isEndReached);
48
67
  }
49
68
  };
69
+ /**
70
+ * Метод для обогащения параметров текущими значениями для инфинити
71
+ */
72
+ this.makeInfiniteExecutor = (offset, cursor, direction) => () => this.executor({
73
+ offset,
74
+ count: this.incrementCount,
75
+ cursor,
76
+ direction,
77
+ });
50
78
  /**
51
79
  * Метод для инвалидации данных
52
80
  */
53
81
  this.invalidate = () => {
54
82
  this.auxiliary.invalidate();
55
83
  };
84
+ this.setOffset = (offset) => {
85
+ this.storage.setData((current) => ({
86
+ offset,
87
+ data: current === null || current === void 0 ? void 0 : current.data,
88
+ isEndReached: Boolean(current === null || current === void 0 ? void 0 : current.isEndReached),
89
+ isStartReached: Boolean(current === null || current === void 0 ? void 0 : current.isStartReached),
90
+ }));
91
+ };
56
92
  /**
57
93
  * Метод для запроса следующего набора данных
94
+ * @param options - параметры дозапроса данных
58
95
  */
59
- this.fetchMore = () => {
96
+ this.fetchMore = (options) => {
97
+ var _a, _b;
98
+ const { direction = 'forward', onSuccess } = options !== null && options !== void 0 ? options : {};
99
+ const isBackward = direction === 'backward';
100
+ const isLimitReached = isBackward ? this.isStartReached : this.isEndReached;
60
101
  // если мы еще не достигли предела
61
- if (!this.isEndReached && this.storage.data) {
62
- // прибавляем к офсету число запрашиваемых элементов
63
- this.storage.setData((current) => {
64
- var _a;
65
- return ({
66
- offset: ((_a = current === null || current === void 0 ? void 0 : current.offset) !== null && _a !== void 0 ? _a : 0) + this.incrementCount,
67
- data: current === null || current === void 0 ? void 0 : current.data,
68
- isEndReached: Boolean(current === null || current === void 0 ? void 0 : current.isEndReached),
69
- });
70
- });
102
+ if (!isLimitReached && this.storage.data) {
103
+ this.fetchMoreStatusStorage.setStartLoading();
104
+ const offsetBeforeExecute = this.offset;
105
+ const increment = (isBackward ? -1 : 1) * this.incrementCount;
106
+ const cursor = isBackward
107
+ ? (_a = this.data) === null || _a === void 0 ? void 0 : _a[0]
108
+ : (_b = this.data) === null || _b === void 0 ? void 0 : _b[this.data.length - 1];
109
+ // прибавляем к offset число запрашиваемых элементов
110
+ const requestedOffset = Math.max(offsetBeforeExecute + increment, 0);
111
+ this.setOffset(requestedOffset);
71
112
  // запускаем запрос с последними параметрами, и флагом необходимости инкремента
72
113
  this.auxiliary
73
- .getUnifiedPromise(this.infiniteExecutor, (resData) => {
114
+ .getUnifiedPromise(this.makeInfiniteExecutor(requestedOffset, cursor, direction), (resData) => {
115
+ var _a;
116
+ this.fetchMoreStatusStorage.setSuccess();
117
+ const currentData = (_a = this.storage.data) === null || _a === void 0 ? void 0 : _a.data;
118
+ const result = isBackward
119
+ ? [...resData, ...currentData]
120
+ : [...currentData, ...resData];
121
+ this.submitSuccess(result, this.calcIsLimitReachedByResult(resData), isBackward);
122
+ onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess({
123
+ offset: requestedOffset,
124
+ cursor: cursor,
125
+ });
126
+ })
127
+ .catch((e) => {
74
128
  var _a;
75
- this.submitSuccess([...(_a = this.storage.data) === null || _a === void 0 ? void 0 : _a.data, ...resData], this.calcIsEndReachedByResult(resData));
129
+ this.fetchMoreStatusStorage.setError(e);
130
+ // в случае ошибки, откатываем значение offset к состоянию до дозапроса
131
+ this.setOffset(offsetBeforeExecute);
132
+ return (_a = this.defaultOnError) === null || _a === void 0 ? void 0 : _a.call(this, e);
76
133
  })
77
- .catch((e) => { var _a; return (_a = this.defaultOnError) === null || _a === void 0 ? void 0 : _a.call(this, e); });
134
+ .finally(this.fetchMoreStatusStorage.setEndLoading);
78
135
  }
79
136
  };
80
137
  /**
@@ -96,14 +153,15 @@ export class InfiniteQuery extends QueryContainer {
96
153
  */
97
154
  this.proceedSync = ({ onSuccess, onError, } = {}) => {
98
155
  this.storage.setData((current) => ({
99
- offset: 0,
156
+ offset: (this.isIdle && this.initialOffset) || 0,
100
157
  data: current === null || current === void 0 ? void 0 : current.data,
101
158
  isEndReached: false,
159
+ isStartReached: false,
102
160
  }));
103
161
  this.auxiliary
104
- .getUnifiedPromise(this.infiniteExecutor, (resData) => {
162
+ .getUnifiedPromise(this.makeInfiniteExecutor(this.offset, this.isIdle ? this.initialCursor : undefined), (resData) => {
105
163
  onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(resData);
106
- this.submitSuccess(resData, this.calcIsEndReachedByResult(resData));
164
+ this.submitSuccess(resData, this.calcIsLimitReachedByResult(resData));
107
165
  })
108
166
  .catch((e) => {
109
167
  var _a;
@@ -130,12 +188,15 @@ export class InfiniteQuery extends QueryContainer {
130
188
  return Promise.resolve((_a = this.storage.data) === null || _a === void 0 ? void 0 : _a.data);
131
189
  }
132
190
  this.storage.setData((current) => ({
133
- offset: 0,
191
+ offset: (this.isIdle && this.initialOffset) || 0,
134
192
  data: current === null || current === void 0 ? void 0 : current.data,
135
193
  isEndReached: false,
194
+ isStartReached: false,
136
195
  }));
137
- return this.auxiliary.getUnifiedPromise(this.infiniteExecutor, (data) => this.submitSuccess(data, this.calcIsEndReachedByResult(data)));
196
+ return this.auxiliary.getUnifiedPromise(this.makeInfiniteExecutor(this.offset, this.isIdle ? this.initialCursor : undefined), (data) => this.submitSuccess(data, this.calcIsLimitReachedByResult(data)));
138
197
  };
198
+ this.initialOffset = initialOffset;
199
+ this.initialCursor = initialCursor;
139
200
  this.storage = dataStorage;
140
201
  this.incrementCount = incrementCount;
141
202
  this.defaultOnError = onError;
@@ -143,15 +204,16 @@ export class InfiniteQuery extends QueryContainer {
143
204
  this.defaultFetchPolicy = fetchPolicy;
144
205
  this.submitValidity = submitValidity;
145
206
  makeObservable(this, {
207
+ fetchMoreStatus: computed,
146
208
  data: computed,
147
209
  computedData: computed,
148
- infiniteExecutor: computed,
149
210
  forceUpdate: action,
150
211
  async: action,
151
212
  sync: action,
152
213
  fetchMore: action,
153
214
  submitSuccess: action,
154
215
  isEndReached: computed,
216
+ isStartReached: computed,
155
217
  });
156
218
  }
157
219
  get isNetworkOnly() {
@@ -172,13 +234,14 @@ export class InfiniteQuery extends QueryContainer {
172
234
  return Boolean((_a = this.storage.data) === null || _a === void 0 ? void 0 : _a.isEndReached);
173
235
  }
174
236
  /**
175
- * Метод для обогащения параметров текущими значениями для инфинити
237
+ * Флаг того, что мы достигли самого начала запрашиваемых элементов
176
238
  */
177
- get infiniteExecutor() {
178
- return () => this.executor({
179
- offset: this.offset,
180
- count: this.incrementCount,
181
- });
239
+ get isStartReached() {
240
+ var _a;
241
+ return Boolean((_a = this.storage.data) === null || _a === void 0 ? void 0 : _a.isStartReached);
242
+ }
243
+ get fetchMoreStatus() {
244
+ return this.fetchMoreStatusStorage.statuses;
182
245
  }
183
246
  get computedData() {
184
247
  var _a;
@@ -108,8 +108,9 @@ export class MobxQuery {
108
108
  */
109
109
  this.getCachedQuery = (key, createInstance, type, createParams) => {
110
110
  var _a, _b;
111
+ const enabledAutoFetch = (_a = createParams === null || createParams === void 0 ? void 0 : createParams.enabledAutoFetch) !== null && _a !== void 0 ? _a : this.defaultEnabledAutoFetch;
111
112
  const fetchPolicy = (createParams === null || createParams === void 0 ? void 0 : createParams.fetchPolicy) || this.defaultFetchPolicy;
112
- const keys = this.makeKeys(key, fetchPolicy, (_a = createParams === null || createParams === void 0 ? void 0 : createParams.isBackground) !== null && _a !== void 0 ? _a : false, type);
113
+ const keys = this.makeKeys(key, fetchPolicy, (_b = createParams === null || createParams === void 0 ? void 0 : createParams.isBackground) !== null && _b !== void 0 ? _b : false, type, enabledAutoFetch);
113
114
  const cachedQuery = this.queriesMap.get(keys.queryKeyHash);
114
115
  if (cachedQuery) {
115
116
  return cachedQuery;
@@ -117,7 +118,7 @@ export class MobxQuery {
117
118
  const query = createInstance({
118
119
  onError: ((createParams === null || createParams === void 0 ? void 0 : createParams.onError) ||
119
120
  this.defaultErrorHandler),
120
- enabledAutoFetch: (_b = createParams === null || createParams === void 0 ? void 0 : createParams.enabledAutoFetch) !== null && _b !== void 0 ? _b : this.defaultEnabledAutoFetch,
121
+ enabledAutoFetch,
121
122
  fetchPolicy,
122
123
  dataStorage: this.queryDataStorageFactory.getStorage(keys.dataKeyHash),
123
124
  statusStorage: this.statusStorageFactory.getStorage(keys.statusKeyHash),
@@ -134,7 +135,7 @@ export class MobxQuery {
134
135
  /**
135
136
  * Метод для создания ключей к внутренним хранилищам
136
137
  */
137
- this.makeKeys = (rootKey, fetchPolicy, isBackground, type) => {
138
+ this.makeKeys = (rootKey, fetchPolicy, isBackground, type, enabledAutoFetch) => {
138
139
  // C введением StrictMode в реакт 18, проявилась проблема,
139
140
  // что network-only квери, созданные в одном реакт компоненте,
140
141
  // создаются дважды (т.к. все хуки вызываются дважды)
@@ -148,7 +149,10 @@ export class MobxQuery {
148
149
  // Этот кейс крайне маловероятен, и будет проявляться только в дев режиме с включенным StrictMode,
149
150
  // поэтому мы пренебрегаем решением этой проблемы, в угоду упрощения.
150
151
  const date = fetchPolicy === 'network-only' ? new Date().setMilliseconds(0) : null;
151
- const queryKey = [...rootKey, { fetchPolicy, date, isBackground, type }];
152
+ const queryKey = [
153
+ ...rootKey,
154
+ { fetchPolicy, date, isBackground, type, enabledAutoFetch },
155
+ ];
152
156
  const queryKeyHash = this.serialize(queryKey);
153
157
  const dataKeyHash = this.serialize([...rootKey, { type }]);
154
158
  const statusKeyHash = this.serialize([...rootKey, { type, date }]);