@tanstack/lit-query 0.2.6 → 0.2.7
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/dist/controllers/BaseController.d.ts +1 -0
- package/dist/controllers/BaseController.d.ts.map +1 -1
- package/dist/controllers/BaseController.js +11 -2
- package/dist/controllers/BaseController.js.map +1 -1
- package/dist/createInfiniteQueryController.d.ts.map +1 -1
- package/dist/createInfiniteQueryController.js +41 -14
- package/dist/createInfiniteQueryController.js.map +1 -1
- package/dist/createQueriesController.d.ts.map +1 -1
- package/dist/createQueriesController.js +80 -15
- package/dist/createQueriesController.js.map +1 -1
- package/dist/createQueryController.d.ts.map +1 -1
- package/dist/createQueryController.js +37 -10
- package/dist/createQueryController.js.map +1 -1
- package/dist/queryObserverResultTracker.d.ts +14 -0
- package/dist/queryObserverResultTracker.d.ts.map +1 -0
- package/dist/queryObserverResultTracker.js +18 -0
- package/dist/queryObserverResultTracker.js.map +1 -0
- package/dist/useMutationState.d.ts +1 -1
- package/dist/useMutationState.d.ts.map +1 -1
- package/dist/useMutationState.js +10 -6
- package/dist/useMutationState.js.map +1 -1
- package/dist-cjs/controllers/BaseController.d.cts +1 -0
- package/dist-cjs/controllers/BaseController.js +11 -2
- package/dist-cjs/controllers/BaseController.js.map +1 -1
- package/dist-cjs/createInfiniteQueryController.js +41 -14
- package/dist-cjs/createInfiniteQueryController.js.map +1 -1
- package/dist-cjs/createQueriesController.js +79 -14
- package/dist-cjs/createQueriesController.js.map +1 -1
- package/dist-cjs/createQueryController.js +37 -10
- package/dist-cjs/createQueryController.js.map +1 -1
- package/dist-cjs/queryObserverResultTracker.d.cts +13 -0
- package/dist-cjs/queryObserverResultTracker.js +22 -0
- package/dist-cjs/queryObserverResultTracker.js.map +1 -0
- package/dist-cjs/useMutationState.d.cts +1 -1
- package/dist-cjs/useMutationState.js +10 -6
- package/dist-cjs/useMutationState.js.map +1 -1
- package/package.json +2 -2
- package/src/controllers/BaseController.ts +10 -2
- package/src/createInfiniteQueryController.ts +53 -14
- package/src/createQueriesController.ts +110 -22
- package/src/createQueryController.ts +47 -10
- package/src/queryObserverResultTracker.ts +30 -0
- package/src/useMutationState.ts +16 -11
|
@@ -5,6 +5,7 @@ const query_core_1 = require("@tanstack/query-core");
|
|
|
5
5
|
const accessor_js_1 = require("./accessor.js");
|
|
6
6
|
const context_js_1 = require("./context.js");
|
|
7
7
|
const BaseController_js_1 = require("./controllers/BaseController.js");
|
|
8
|
+
const queryObserverResultTracker_js_1 = require("./queryObserverResultTracker.js");
|
|
8
9
|
function createPendingQueryResult() {
|
|
9
10
|
return {
|
|
10
11
|
data: undefined,
|
|
@@ -38,6 +39,7 @@ function createPendingQueryResult() {
|
|
|
38
39
|
class QueryController extends BaseController_js_1.BaseController {
|
|
39
40
|
options;
|
|
40
41
|
observer;
|
|
42
|
+
resultTracker = new queryObserverResultTracker_js_1.QueryObserverResultTracker();
|
|
41
43
|
unsubscribe;
|
|
42
44
|
queryClient;
|
|
43
45
|
constructor(host, options, queryClient) {
|
|
@@ -54,7 +56,7 @@ class QueryController extends BaseController_js_1.BaseController {
|
|
|
54
56
|
const observer = new query_core_1.QueryObserver(initialClient, defaulted);
|
|
55
57
|
this.queryClient = initialClient;
|
|
56
58
|
this.observer = observer;
|
|
57
|
-
this.
|
|
59
|
+
this.assignObserverResult(observer.getOptimisticResult(defaulted));
|
|
58
60
|
}
|
|
59
61
|
onConnected() {
|
|
60
62
|
if (!this.syncClient()) {
|
|
@@ -64,7 +66,7 @@ class QueryController extends BaseController_js_1.BaseController {
|
|
|
64
66
|
this.subscribe();
|
|
65
67
|
this.observer?.updateResult();
|
|
66
68
|
if (this.observer) {
|
|
67
|
-
this.
|
|
69
|
+
this.setObserverResult(this.observer.getCurrentResult());
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
onDisconnected() {
|
|
@@ -88,14 +90,14 @@ class QueryController extends BaseController_js_1.BaseController {
|
|
|
88
90
|
this.subscribe();
|
|
89
91
|
this.observer?.updateResult();
|
|
90
92
|
if (this.observer) {
|
|
91
|
-
this.
|
|
93
|
+
this.setObserverResult(this.observer.getCurrentResult());
|
|
92
94
|
}
|
|
93
95
|
}
|
|
94
96
|
refetch = (...args) => {
|
|
95
|
-
if (!this.
|
|
97
|
+
if (!this.applyOptions() || !this.observer) {
|
|
96
98
|
return Promise.reject((0, context_js_1.createMissingQueryClientError)());
|
|
97
99
|
}
|
|
98
|
-
return this.
|
|
100
|
+
return this.observer.refetch(...args);
|
|
99
101
|
};
|
|
100
102
|
suspense = async () => {
|
|
101
103
|
if (!this.syncClient() || !this.observer || !this.queryClient) {
|
|
@@ -109,6 +111,12 @@ class QueryController extends BaseController_js_1.BaseController {
|
|
|
109
111
|
}
|
|
110
112
|
return optimistic;
|
|
111
113
|
};
|
|
114
|
+
readCurrent() {
|
|
115
|
+
if (this.observer) {
|
|
116
|
+
this.assignObserverResult(this.observer.getCurrentResult());
|
|
117
|
+
}
|
|
118
|
+
return this.current;
|
|
119
|
+
}
|
|
112
120
|
subscribe() {
|
|
113
121
|
if (!this.observer) {
|
|
114
122
|
return;
|
|
@@ -117,7 +125,7 @@ class QueryController extends BaseController_js_1.BaseController {
|
|
|
117
125
|
return;
|
|
118
126
|
}
|
|
119
127
|
this.unsubscribe = this.observer.subscribe((next) => {
|
|
120
|
-
this.
|
|
128
|
+
this.setObserverResult(next);
|
|
121
129
|
});
|
|
122
130
|
}
|
|
123
131
|
unsubscribeObserver() {
|
|
@@ -130,6 +138,7 @@ class QueryController extends BaseController_js_1.BaseController {
|
|
|
130
138
|
this.unsubscribeObserver();
|
|
131
139
|
this.queryClient = undefined;
|
|
132
140
|
this.observer = undefined;
|
|
141
|
+
this.resultTracker.reset();
|
|
133
142
|
this.setResult(createPendingQueryResult());
|
|
134
143
|
return false;
|
|
135
144
|
}
|
|
@@ -140,18 +149,36 @@ class QueryController extends BaseController_js_1.BaseController {
|
|
|
140
149
|
this.queryClient = nextClient;
|
|
141
150
|
const options = this.defaultOptions();
|
|
142
151
|
this.observer = new query_core_1.QueryObserver(this.queryClient, options);
|
|
143
|
-
this.
|
|
152
|
+
this.setObserverResult(this.observer.getOptimisticResult(options));
|
|
144
153
|
return true;
|
|
145
154
|
}
|
|
146
|
-
|
|
155
|
+
applyOptions() {
|
|
147
156
|
if (!this.syncClient() || !this.observer) {
|
|
148
157
|
return false;
|
|
149
158
|
}
|
|
150
159
|
const options = this.defaultOptions(this.queryClient);
|
|
151
160
|
this.observer.setOptions(options);
|
|
152
|
-
this.setResult(this.observer.getCurrentResult());
|
|
153
161
|
return true;
|
|
154
162
|
}
|
|
163
|
+
refreshOptions() {
|
|
164
|
+
if (!this.applyOptions() || !this.observer) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
this.setObserverResult(this.observer.getCurrentResult());
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
assignObserverResult(result) {
|
|
171
|
+
const trackedResult = this.resultTracker.update(this.observer, result);
|
|
172
|
+
if (trackedResult) {
|
|
173
|
+
this.result = trackedResult;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
setObserverResult(result) {
|
|
177
|
+
const trackedResult = this.resultTracker.update(this.observer, result);
|
|
178
|
+
if (trackedResult) {
|
|
179
|
+
this.setResult(trackedResult);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
155
182
|
defaultOptions(client = this.queryClient) {
|
|
156
183
|
const resolvedClient = client ?? this.tryGetQueryClient();
|
|
157
184
|
if (!resolvedClient) {
|
|
@@ -205,7 +232,7 @@ class QueryController extends BaseController_js_1.BaseController {
|
|
|
205
232
|
*/
|
|
206
233
|
function createQueryController(host, options, queryClient) {
|
|
207
234
|
const controller = new QueryController(host, options, queryClient);
|
|
208
|
-
return Object.assign((0, accessor_js_1.createValueAccessor)(() => controller.
|
|
235
|
+
return Object.assign((0, accessor_js_1.createValueAccessor)(() => controller.readCurrent()), {
|
|
209
236
|
refetch: controller.refetch,
|
|
210
237
|
suspense: controller.suspense,
|
|
211
238
|
destroy: () => controller.destroy(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createQueryController.js","sourceRoot":"","sources":["../src/createQueryController.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"createQueryController.js","sourceRoot":"","sources":["../src/createQueryController.ts"],"names":[],"mappings":";;AAmWA,sDAuBC;AA1XD,qDAO6B;AAG7B,+CAKsB;AACtB,6CAA4D;AAC5D,uEAAgE;AAChE,mFAA4E;AAkC5E,SAAS,wBAAwB;IAI/B,OAAO;QACL,IAAI,EAAE,SAAS;QACf,aAAa,EAAE,CAAC;QAChB,KAAK,EAAE,IAAI;QACX,cAAc,EAAE,CAAC;QACjB,YAAY,EAAE,CAAC;QACf,aAAa,EAAE,IAAI;QACnB,gBAAgB,EAAE,CAAC;QACnB,OAAO,EAAE,KAAK;QACd,SAAS,EAAE,KAAK;QAChB,mBAAmB,EAAE,KAAK;QAC1B,UAAU,EAAE,KAAK;QACjB,gBAAgB,EAAE,KAAK;QACvB,SAAS,EAAE,KAAK;QAChB,cAAc,EAAE,KAAK;QACrB,QAAQ,EAAE,KAAK;QACf,SAAS,EAAE,IAAI;QACf,iBAAiB,EAAE,KAAK;QACxB,cAAc,EAAE,KAAK;QACrB,YAAY,EAAE,KAAK;QACnB,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,IAAI;QACf,SAAS,EAAE,KAAK;QAChB,WAAW,EAAE,MAAM;QACnB,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE,CAAC,GAAG,EAAE,CACb,OAAO,CAAC,MAAM,CAAC,IAAA,0CAA6B,GAAE,CAAC,CAGrC;QACZ,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,SAAkB,CAAC;KACI,CAAA;AACpD,CAAC;AAED,MAAM,eAMJ,SAAQ,kCAAkD;IACzC,OAAO,CAEvB;IACO,QAAQ,CAEH;IACI,aAAa,GAAG,IAAI,0DAA0B,EAE5D,CAAA;IACK,WAAW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eProps?: unknown;
|
|
4
|
+
};
|
|
5
|
+
trackResult: (result: TResult) => unknown;
|
|
6
|
+
};
|
|
7
|
+
export declare class QueryObserverResultTracker<TResult extends object> {
|
|
8
|
+
private result;
|
|
9
|
+
private usesTracking;
|
|
10
|
+
reset(): void;
|
|
11
|
+
update(observer: TrackableQueryObserver<TResult> | undefined, result: TResult): TResult | undefined;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QueryObserverResultTracker = void 0;
|
|
4
|
+
class QueryObserverResultTracker {
|
|
5
|
+
result;
|
|
6
|
+
usesTracking = false;
|
|
7
|
+
reset() {
|
|
8
|
+
this.result = undefined;
|
|
9
|
+
this.usesTracking = false;
|
|
10
|
+
}
|
|
11
|
+
update(observer, result) {
|
|
12
|
+
const usesTracking = !!observer && !observer.options.notifyOnChangeProps;
|
|
13
|
+
if (Object.is(this.result, result) && this.usesTracking === usesTracking) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
this.result = result;
|
|
17
|
+
this.usesTracking = usesTracking;
|
|
18
|
+
return usesTracking ? observer.trackResult(result) : result;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.QueryObserverResultTracker = QueryObserverResultTracker;
|
|
22
|
+
//# sourceMappingURL=queryObserverResultTracker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"queryObserverResultTracker.js","sourceRoot":"","sources":["../src/queryObserverResultTracker.ts"],"names":[],"mappings":";;;AAKA,MAAa,0BAA0B;IAC7B,MAAM,CAAqB;IAC3B,YAAY,GAAG,KAAK,CAAA;IAE5B,KAAK;QACH,IAAI,CAAC,MAAM,GAAG,SAAS,CAAA;QACvB,IAAI,CAAC,YAAY,GAAG,KAAK,CAAA;IAC3B,CAAC;IAED,MAAM,CACJ,QAAqD,EACrD,MAAe;QAEf,MAAM,YAAY,GAAG,CAAC,CAAC,QAAQ,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAA;QAExE,IAAI,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,IAAI,CAAC,YAAY,KAAK,YAAY,EAAE,CAAC;YACzE,OAAO,SAAS,CAAA;QAClB,CAAC;QAED,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;QACpB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAA;QAEhC,OAAO,YAAY,CAAC,CAAC,CAAE,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAa,CAAC,CAAC,CAAC,MAAM,CAAA;IAC1E,CAAC;CACF;AAxBD,gEAwBC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Mutation, type MutationFilters, type MutationState, type QueryClient } from '@tanstack/query-core';
|
|
2
2
|
import type { ReactiveControllerHost } from 'lit' with { "resolution-mode": "import" };
|
|
3
3
|
import { type Accessor, type ValueAccessor } from './accessor.cjs';
|
|
4
4
|
/**
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useMutationState = useMutationState;
|
|
4
|
+
const query_core_1 = require("@tanstack/query-core");
|
|
4
5
|
const accessor_js_1 = require("./accessor.js");
|
|
5
6
|
const BaseController_js_1 = require("./controllers/BaseController.js");
|
|
6
7
|
class MutationStateController extends BaseController_js_1.BaseController {
|
|
@@ -18,11 +19,11 @@ class MutationStateController extends BaseController_js_1.BaseController {
|
|
|
18
19
|
}
|
|
19
20
|
onConnected() {
|
|
20
21
|
if (!this.syncClient()) {
|
|
21
|
-
this.
|
|
22
|
+
this.setMutationState([]);
|
|
22
23
|
return;
|
|
23
24
|
}
|
|
24
25
|
this.subscribe();
|
|
25
|
-
this.
|
|
26
|
+
this.setMutationState(this.computeState());
|
|
26
27
|
}
|
|
27
28
|
onDisconnected() {
|
|
28
29
|
this.unsubscribe?.();
|
|
@@ -33,16 +34,16 @@ class MutationStateController extends BaseController_js_1.BaseController {
|
|
|
33
34
|
if (!this.shouldRefreshOnHostUpdate()) {
|
|
34
35
|
return;
|
|
35
36
|
}
|
|
36
|
-
this.
|
|
37
|
+
this.setMutationState(this.syncClient() ? this.computeState() : []);
|
|
37
38
|
}
|
|
38
39
|
onQueryClientChanged() {
|
|
39
40
|
if (!this.syncClient()) {
|
|
40
|
-
this.
|
|
41
|
+
this.setMutationState([]);
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
43
44
|
if (this.connectedState) {
|
|
44
45
|
this.subscribe();
|
|
45
|
-
this.
|
|
46
|
+
this.setMutationState(this.computeState());
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
syncClient() {
|
|
@@ -69,9 +70,12 @@ class MutationStateController extends BaseController_js_1.BaseController {
|
|
|
69
70
|
return;
|
|
70
71
|
}
|
|
71
72
|
this.unsubscribe = this.queryClient.getMutationCache().subscribe(() => {
|
|
72
|
-
this.
|
|
73
|
+
this.setMutationState(this.computeState());
|
|
73
74
|
});
|
|
74
75
|
}
|
|
76
|
+
setMutationState(next) {
|
|
77
|
+
this.setResult((0, query_core_1.replaceEqualDeep)(this.result, next));
|
|
78
|
+
}
|
|
75
79
|
shouldRefreshOnHostUpdate() {
|
|
76
80
|
return (typeof this.options.filters === 'function' ||
|
|
77
81
|
typeof this.options.select === 'function');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMutationState.js","sourceRoot":"","sources":["../src/useMutationState.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"useMutationState.js","sourceRoot":"","sources":["../src/useMutationState.ts"],"names":[],"mappings":";;AA+LA,4CAcC;AA7MD,qDAM6B;AAE7B,+CAKsB;AACtB,uEAAgE;AAuBhE,MAAM,uBAAiC,SAAQ,kCAAyB;IAMnD;IALX,WAAW,CAAyB;IAC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,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,OAAO,EAAE,CAAA;QACX,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO;YAClC,CAAC,CAAC,IAAA,0BAAY,EAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC;YACpC,CAAC,CAAC,SAAS,CAAA;QAEb,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAA;QAClC,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;QAEtE,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;YAChC,IAAI,MAAM,EAAE,CAAC;gBACX,OAAO,MAAM,CAAC,QAAQ,CAAC,CAAA;YACzB,CAAC;YAED,OAAO,QAAQ,CAAC,KAAgB,CAAA;QAClC,CAAC,CAAC,CAAA;IACJ,CAAC;CACF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,SAAgB,gBAAgB,CAG9B,IAA4B,EAC5B,UAAyC,EAAE,EAC3C,WAAyB;IAEzB,MAAM,UAAU,GAAG,IAAI,uBAAuB,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,CAAA;IAC1E,OAAO,MAAM,CAAC,MAAM,CAClB,IAAA,iCAAmB,EAAC,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAC7C;QACE,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE;KACpC,CACF,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/lit-query",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.7",
|
|
4
4
|
"description": "Lit adapter for TanStack Query Core",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@lit/context": "^1.1.6",
|
|
45
45
|
"lit": "^3.3.1",
|
|
46
|
-
"@tanstack/query-core": "5.
|
|
46
|
+
"@tanstack/query-core": "5.101.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"@tanstack/query-core": "^5.0.0",
|
|
@@ -24,6 +24,7 @@ export abstract class BaseController<TResult> implements ReactiveController {
|
|
|
24
24
|
private updateQueued = false
|
|
25
25
|
private clientChangeQueued = false
|
|
26
26
|
private connectionAttempt = 0
|
|
27
|
+
private isHostUpdating = false
|
|
27
28
|
private queryClientResolutionState: QueryClientResolutionState
|
|
28
29
|
|
|
29
30
|
protected constructor(
|
|
@@ -92,7 +93,12 @@ export abstract class BaseController<TResult> implements ReactiveController {
|
|
|
92
93
|
return
|
|
93
94
|
}
|
|
94
95
|
|
|
95
|
-
this.
|
|
96
|
+
this.isHostUpdating = true
|
|
97
|
+
try {
|
|
98
|
+
this.onHostUpdate()
|
|
99
|
+
} finally {
|
|
100
|
+
this.isHostUpdating = false
|
|
101
|
+
}
|
|
96
102
|
}
|
|
97
103
|
|
|
98
104
|
destroy(): void {
|
|
@@ -133,7 +139,9 @@ export abstract class BaseController<TResult> implements ReactiveController {
|
|
|
133
139
|
}
|
|
134
140
|
|
|
135
141
|
this.result = next
|
|
136
|
-
this.
|
|
142
|
+
if (!this.isHostUpdating) {
|
|
143
|
+
this.queueUpdate()
|
|
144
|
+
}
|
|
137
145
|
}
|
|
138
146
|
|
|
139
147
|
get current(): TResult {
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
} from './accessor.js'
|
|
18
18
|
import { createMissingQueryClientError } from './context.js'
|
|
19
19
|
import { BaseController } from './controllers/BaseController.js'
|
|
20
|
+
import { QueryObserverResultTracker } from './queryObserverResultTracker.js'
|
|
20
21
|
|
|
21
22
|
/**
|
|
22
23
|
* Options accepted by `createInfiniteQueryController`.
|
|
@@ -131,6 +132,9 @@ class InfiniteQueryController<
|
|
|
131
132
|
private observer:
|
|
132
133
|
| InfiniteQueryObserver<TQueryFnData, TError, TData, TQueryKey, TPageParam>
|
|
133
134
|
| undefined
|
|
135
|
+
private readonly resultTracker = new QueryObserverResultTracker<
|
|
136
|
+
InfiniteQueryObserverResult<TData, TError>
|
|
137
|
+
>()
|
|
134
138
|
private unsubscribe: (() => void) | undefined
|
|
135
139
|
private queryClient: QueryClient | undefined
|
|
136
140
|
|
|
@@ -162,7 +166,7 @@ class InfiniteQueryController<
|
|
|
162
166
|
const observer = new InfiniteQueryObserver(queryClient, defaulted)
|
|
163
167
|
this.queryClient = queryClient
|
|
164
168
|
this.observer = observer
|
|
165
|
-
this.
|
|
169
|
+
this.assignObserverResult(observer.getOptimisticResult(defaulted))
|
|
166
170
|
}
|
|
167
171
|
|
|
168
172
|
protected onConnected(): void {
|
|
@@ -174,7 +178,7 @@ class InfiniteQueryController<
|
|
|
174
178
|
this.subscribe()
|
|
175
179
|
this.observer?.updateResult()
|
|
176
180
|
if (this.observer) {
|
|
177
|
-
this.
|
|
181
|
+
this.setObserverResult(this.observer.getCurrentResult())
|
|
178
182
|
}
|
|
179
183
|
}
|
|
180
184
|
|
|
@@ -200,39 +204,47 @@ class InfiniteQueryController<
|
|
|
200
204
|
this.subscribe()
|
|
201
205
|
this.observer?.updateResult()
|
|
202
206
|
if (this.observer) {
|
|
203
|
-
this.
|
|
207
|
+
this.setObserverResult(this.observer.getCurrentResult())
|
|
204
208
|
}
|
|
205
209
|
}
|
|
206
210
|
|
|
207
211
|
refetch: InfiniteQueryObserverResult<TData, TError>['refetch'] = (
|
|
208
212
|
...args
|
|
209
213
|
) => {
|
|
210
|
-
if (!this.
|
|
214
|
+
if (!this.applyOptions() || !this.observer) {
|
|
211
215
|
return Promise.reject(createMissingQueryClientError())
|
|
212
216
|
}
|
|
213
217
|
|
|
214
|
-
return this.
|
|
218
|
+
return this.observer.refetch(...args)
|
|
215
219
|
}
|
|
216
220
|
|
|
217
221
|
fetchNextPage: InfiniteQueryObserverResult<TData, TError>['fetchNextPage'] = (
|
|
218
222
|
...args
|
|
219
223
|
) => {
|
|
220
|
-
if (!this.
|
|
224
|
+
if (!this.applyOptions() || !this.observer) {
|
|
221
225
|
return Promise.reject(createMissingQueryClientError())
|
|
222
226
|
}
|
|
223
227
|
|
|
224
|
-
return this.
|
|
228
|
+
return this.observer.fetchNextPage(...args)
|
|
225
229
|
}
|
|
226
230
|
|
|
227
231
|
fetchPreviousPage: InfiniteQueryObserverResult<
|
|
228
232
|
TData,
|
|
229
233
|
TError
|
|
230
234
|
>['fetchPreviousPage'] = (...args) => {
|
|
231
|
-
if (!this.
|
|
235
|
+
if (!this.applyOptions() || !this.observer) {
|
|
232
236
|
return Promise.reject(createMissingQueryClientError())
|
|
233
237
|
}
|
|
234
238
|
|
|
235
|
-
return this.
|
|
239
|
+
return this.observer.fetchPreviousPage(...args)
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
readCurrent(): InfiniteQueryObserverResult<TData, TError> {
|
|
243
|
+
if (this.observer) {
|
|
244
|
+
this.assignObserverResult(this.observer.getCurrentResult())
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
return this.current
|
|
236
248
|
}
|
|
237
249
|
|
|
238
250
|
private subscribe(): void {
|
|
@@ -245,7 +257,7 @@ class InfiniteQueryController<
|
|
|
245
257
|
}
|
|
246
258
|
|
|
247
259
|
this.unsubscribe = this.observer.subscribe((next) => {
|
|
248
|
-
this.
|
|
260
|
+
this.setObserverResult(next)
|
|
249
261
|
})
|
|
250
262
|
}
|
|
251
263
|
|
|
@@ -260,6 +272,7 @@ class InfiniteQueryController<
|
|
|
260
272
|
this.unsubscribeObserver()
|
|
261
273
|
this.queryClient = undefined
|
|
262
274
|
this.observer = undefined
|
|
275
|
+
this.resultTracker.reset()
|
|
263
276
|
this.setResult(createPendingInfiniteQueryResult())
|
|
264
277
|
return false
|
|
265
278
|
}
|
|
@@ -272,21 +285,47 @@ class InfiniteQueryController<
|
|
|
272
285
|
this.queryClient = nextClient
|
|
273
286
|
const options = this.defaultOptions(this.queryClient)
|
|
274
287
|
this.observer = new InfiniteQueryObserver(this.queryClient, options)
|
|
275
|
-
this.
|
|
288
|
+
this.setObserverResult(this.observer.getOptimisticResult(options))
|
|
276
289
|
return true
|
|
277
290
|
}
|
|
278
291
|
|
|
279
|
-
private
|
|
292
|
+
private applyOptions(): boolean {
|
|
280
293
|
if (!this.syncClient() || !this.observer || !this.queryClient) {
|
|
281
294
|
return false
|
|
282
295
|
}
|
|
283
296
|
|
|
284
297
|
const options = this.defaultOptions(this.queryClient)
|
|
285
298
|
this.observer.setOptions(options)
|
|
286
|
-
this.setResult(this.observer.getOptimisticResult(options))
|
|
287
299
|
return true
|
|
288
300
|
}
|
|
289
301
|
|
|
302
|
+
private refreshOptions(): boolean {
|
|
303
|
+
if (!this.applyOptions() || !this.observer) {
|
|
304
|
+
return false
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
this.setObserverResult(this.observer.getCurrentResult())
|
|
308
|
+
return true
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
private assignObserverResult(
|
|
312
|
+
result: InfiniteQueryObserverResult<TData, TError>,
|
|
313
|
+
): void {
|
|
314
|
+
const trackedResult = this.resultTracker.update(this.observer, result)
|
|
315
|
+
if (trackedResult) {
|
|
316
|
+
this.result = trackedResult
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
private setObserverResult(
|
|
321
|
+
result: InfiniteQueryObserverResult<TData, TError>,
|
|
322
|
+
): void {
|
|
323
|
+
const trackedResult = this.resultTracker.update(this.observer, result)
|
|
324
|
+
if (trackedResult) {
|
|
325
|
+
this.setResult(trackedResult)
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
|
|
290
329
|
private defaultOptions(
|
|
291
330
|
client = this.queryClient,
|
|
292
331
|
): DefaultedInfiniteQueryObserverOptions<
|
|
@@ -383,7 +422,7 @@ export function createInfiniteQueryController<
|
|
|
383
422
|
const controller = new InfiniteQueryController(host, options, queryClient)
|
|
384
423
|
|
|
385
424
|
return Object.assign(
|
|
386
|
-
createValueAccessor(() => controller.
|
|
425
|
+
createValueAccessor(() => controller.readCurrent()),
|
|
387
426
|
{
|
|
388
427
|
refetch: controller.refetch,
|
|
389
428
|
fetchNextPage: controller.fetchNextPage,
|