@isograph/react 0.0.0-main-8a48dfd6 → 0.0.0-main-caa0e3a8
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/.turbo/turbo-compile-libs.log +1 -1
- package/dist/core/cache.js +3 -3
- package/dist/core/garbageCollection.js +1 -1
- package/dist/core/makeNetworkRequest.js +1 -1
- package/dist/core/optimisticProxy.js +1 -1
- package/dist/core/read.js +1 -1
- package/dist/core/startUpdate.js +1 -1
- package/dist/loadable-hooks/useConnectionSpecPagination.d.ts.map +1 -1
- package/dist/loadable-hooks/useConnectionSpecPagination.js +15 -11
- package/dist/loadable-hooks/useSkipLimitPagination.d.ts.map +1 -1
- package/dist/loadable-hooks/useSkipLimitPagination.js +14 -10
- package/package.json +4 -4
- package/src/core/cache.ts +2 -2
- package/src/core/garbageCollection.ts +1 -1
- package/src/core/makeNetworkRequest.ts +1 -1
- package/src/core/optimisticProxy.ts +1 -1
- package/src/core/read.ts +1 -1
- package/src/core/startUpdate.ts +1 -1
- package/src/loadable-hooks/useConnectionSpecPagination.ts +12 -8
- package/src/loadable-hooks/useSkipLimitPagination.ts +12 -8
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
../.. | WARN Unsupported engine: wanted: {"node":"22.9.0"} (current: {"node":"v22.21.1","pnpm":"10.15.0"})
|
|
2
2
|
|
|
3
|
-
> @isograph/react@0.0.0-main-
|
|
3
|
+
> @isograph/react@0.0.0-main-caa0e3a8 compile-libs /home/runner/work/isograph/isograph/libs/isograph-react
|
|
4
4
|
> rimraf dist && tsc -p tsconfig.pkg.json
|
|
5
5
|
|
package/dist/core/cache.js
CHANGED
|
@@ -34,7 +34,7 @@ function getOrCreateItemInSuspenseCache(environment, index, factory) {
|
|
|
34
34
|
* results.
|
|
35
35
|
*/
|
|
36
36
|
function stableCopy(value) {
|
|
37
|
-
if (
|
|
37
|
+
if (value == null || typeof value !== 'object') {
|
|
38
38
|
return value;
|
|
39
39
|
}
|
|
40
40
|
if (isArray(value)) {
|
|
@@ -169,8 +169,8 @@ function callSubscriptions(environment, recordsEncounteredWhenNormalizing) {
|
|
|
169
169
|
return;
|
|
170
170
|
}
|
|
171
171
|
case 'AnyChangesToRecord': {
|
|
172
|
-
if ((_a = recordsEncounteredWhenNormalizing
|
|
173
|
-
.get(subscription.recordLink.__typename)) === null || _a === void 0 ? void 0 : _a.has(subscription.recordLink.__link)) {
|
|
172
|
+
if (((_a = recordsEncounteredWhenNormalizing
|
|
173
|
+
.get(subscription.recordLink.__typename)) === null || _a === void 0 ? void 0 : _a.has(subscription.recordLink.__link)) != null) {
|
|
174
174
|
logAnyError(environment, { situation: 'calling AnyChangesToRecord callback' }, () => subscription.callback());
|
|
175
175
|
}
|
|
176
176
|
return;
|
|
@@ -76,7 +76,7 @@ function recordReachableIds(dataLayer, retainedQuery, mutableRetainedIds) {
|
|
|
76
76
|
const record = (_a = dataLayer[retainedQuery.root.__typename]) === null || _a === void 0 ? void 0 : _a[retainedQuery.root.__link];
|
|
77
77
|
const retainedRecordsIds = ((_b = mutableRetainedIds[_c = retainedQuery.root.__typename]) !== null && _b !== void 0 ? _b : (mutableRetainedIds[_c] = new Set()));
|
|
78
78
|
retainedRecordsIds.add(retainedQuery.root.__link);
|
|
79
|
-
if (record) {
|
|
79
|
+
if (record != null) {
|
|
80
80
|
recordReachableIdsFromRecord(dataLayer, record, mutableRetainedIds, retainedQuery.normalizationAst.result.value.selections, retainedQuery.variables);
|
|
81
81
|
}
|
|
82
82
|
}
|
|
@@ -261,7 +261,7 @@ function makeOptimisticUpdate(environment, artifact, variables, optimisticNetwor
|
|
|
261
261
|
return optimistic;
|
|
262
262
|
}
|
|
263
263
|
function revertOptimisticStoreLayerAndMaybeReplaceIfUndisposedIncomplete(environment, status, normalizeData) {
|
|
264
|
-
if (status.optimistic) {
|
|
264
|
+
if (status.optimistic != null) {
|
|
265
265
|
(0, optimisticProxy_1.revertOptimisticStoreLayerAndMaybeReplace)(environment, status.optimistic, normalizeData);
|
|
266
266
|
}
|
|
267
267
|
return {
|
|
@@ -214,7 +214,7 @@ function addOptimisticNetworkResponseStoreLayer(parent) {
|
|
|
214
214
|
* set baseStoreLayer.childStoreLayer = storeLayerToMerge (via setChildOfNode).
|
|
215
215
|
*/
|
|
216
216
|
function mergeLayersWithDataIntoBaseLayer(environment, storeLayerToMerge, baseStoreLayer) {
|
|
217
|
-
while (storeLayerToMerge &&
|
|
217
|
+
while (storeLayerToMerge != null &&
|
|
218
218
|
storeLayerToMerge.kind !== 'OptimisticUpdaterStoreLayer') {
|
|
219
219
|
mergeDataLayer(baseStoreLayer.data, storeLayerToMerge.data);
|
|
220
220
|
storeLayerToMerge = storeLayerToMerge.childStoreLayer;
|
package/dist/core/read.js
CHANGED
|
@@ -381,7 +381,7 @@ function readScalarFieldData(field, storeRecord, root, variables) {
|
|
|
381
381
|
function readLinkedFieldData(environment, field, storeRecord, root, variables, nestedRefetchQueries, networkRequest, networkRequestOptions, readData) {
|
|
382
382
|
const storeRecordName = (0, cache_1.getParentRecordKey)(field, variables);
|
|
383
383
|
let value = storeRecord[storeRecordName];
|
|
384
|
-
if (field.condition) {
|
|
384
|
+
if (field.condition != null) {
|
|
385
385
|
const data = readData(field.condition.readerAst, root);
|
|
386
386
|
if (data.kind === 'MissingData') {
|
|
387
387
|
return {
|
package/dist/core/startUpdate.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConnectionSpecPagination.d.ts","sourceRoot":"","sources":["../../src/loadable-hooks/useConnectionSpecPagination.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EACL,iBAAiB,EACjB,KAAK,qBAAqB,EAC3B,MAAM,2BAA2B,CAAC;AAMnC,OAAO,EAAE,aAAa,EAAkB,MAAM,gBAAgB,CAAC;AAM/D,MAAM,MAAM,wBAAwB,CAClC,cAAc,SAAS,qBAAqB,EAC5C,KAAK,IAEH;IACE,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BAAqB,EAC5C,KAAK,EAEL,aAAa,EAAE,aAAa,CAC1B,cAAc,EACd,UAAU,CAAC,KAAK,CAAC,EACjB,+BAA+B,CAChC,EACD,YAAY,CAAC,EAAE,QAAQ,GACtB,wBAAwB,CAAC,cAAc,EAAE,KAAK,CAAC,CAwQjD"}
|
|
@@ -21,7 +21,7 @@ function flatten(arr) {
|
|
|
21
21
|
return outArray;
|
|
22
22
|
}
|
|
23
23
|
function useConnectionSpecPagination(loadableField, initialState) {
|
|
24
|
-
var _a, _b;
|
|
24
|
+
var _a, _b, _c;
|
|
25
25
|
const networkRequestOptions = {
|
|
26
26
|
suspendIfInFlight: true,
|
|
27
27
|
throwOnNetworkError: true,
|
|
@@ -106,13 +106,17 @@ function useConnectionSpecPagination(loadableField, initialState) {
|
|
|
106
106
|
const loadedReferences = state === react_disposable_state_1.UNASSIGNED_STATE ? [] : state;
|
|
107
107
|
const mostRecentItem = loadedReferences[loadedReferences.length - 1];
|
|
108
108
|
const mostRecentFragmentReference = mostRecentItem === null || mostRecentItem === void 0 ? void 0 : mostRecentItem[0].getItemIfNotDisposed();
|
|
109
|
-
if (mostRecentItem && mostRecentFragmentReference === null) {
|
|
109
|
+
if (mostRecentItem != null && mostRecentFragmentReference === null) {
|
|
110
110
|
throw new Error('FragmentReference is unexpectedly disposed. \
|
|
111
111
|
This is indicative of a bug in Isograph.');
|
|
112
112
|
}
|
|
113
|
-
const networkRequestStatus = mostRecentFragmentReference
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
const networkRequestStatus = mostRecentFragmentReference != null
|
|
114
|
+
? {
|
|
115
|
+
mostRecentFragmentReference,
|
|
116
|
+
state: (0, PromiseWrapper_1.getPromiseState)(mostRecentFragmentReference.networkRequest),
|
|
117
|
+
}
|
|
118
|
+
: null;
|
|
119
|
+
const slicedFragmentReferences = ((_a = networkRequestStatus === null || networkRequestStatus === void 0 ? void 0 : networkRequestStatus.state) === null || _a === void 0 ? void 0 : _a.kind) === 'Ok'
|
|
116
120
|
? loadedReferences
|
|
117
121
|
: loadedReferences.slice(0, loadedReferences.length - 1);
|
|
118
122
|
const completedFragmentReferences = slicedFragmentReferences.map(([pointer]) => {
|
|
@@ -125,11 +129,11 @@ function useConnectionSpecPagination(loadableField, initialState) {
|
|
|
125
129
|
});
|
|
126
130
|
const readOutDataAndRecords = completedFragmentReferences.map((fragmentReference) => (0, read_1.readButDoNotEvaluate)(environment, fragmentReference, networkRequestOptions));
|
|
127
131
|
(0, useReadAndSubscribe_1.useSubscribeToMultiple)(subscribeCompletedFragmentReferences(completedFragmentReferences));
|
|
128
|
-
if (
|
|
129
|
-
if ((
|
|
132
|
+
if (networkRequestStatus == null) {
|
|
133
|
+
if ((_b = initialState === null || initialState === void 0 ? void 0 : initialState.hasNextPage) !== null && _b !== void 0 ? _b : true) {
|
|
130
134
|
return {
|
|
131
135
|
kind: 'HasMoreRecords',
|
|
132
|
-
fetchMore: getFetchMore((
|
|
136
|
+
fetchMore: getFetchMore((_c = initialState === null || initialState === void 0 ? void 0 : initialState.endCursor) !== null && _c !== void 0 ? _c : null),
|
|
133
137
|
results: [],
|
|
134
138
|
};
|
|
135
139
|
}
|
|
@@ -140,7 +144,7 @@ function useConnectionSpecPagination(loadableField, initialState) {
|
|
|
140
144
|
};
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
|
-
switch (networkRequestStatus.kind) {
|
|
147
|
+
switch (networkRequestStatus.state.kind) {
|
|
144
148
|
case 'Pending': {
|
|
145
149
|
const unsubscribe = (0, cache_1.subscribeToAnyChange)(environment, () => {
|
|
146
150
|
unsubscribe();
|
|
@@ -150,11 +154,11 @@ function useConnectionSpecPagination(loadableField, initialState) {
|
|
|
150
154
|
return {
|
|
151
155
|
results: results.edges,
|
|
152
156
|
kind: 'Pending',
|
|
153
|
-
pendingFragment: mostRecentFragmentReference,
|
|
157
|
+
pendingFragment: networkRequestStatus.mostRecentFragmentReference,
|
|
154
158
|
};
|
|
155
159
|
}
|
|
156
160
|
case 'Err': {
|
|
157
|
-
throw networkRequestStatus.error;
|
|
161
|
+
throw networkRequestStatus.state.error;
|
|
158
162
|
}
|
|
159
163
|
case 'Ok': {
|
|
160
164
|
const results = readCompletedFragmentReferences(completedFragmentReferences);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSkipLimitPagination.d.ts","sourceRoot":"","sources":["../../src/loadable-hooks/useSkipLimitPagination.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EACL,iBAAiB,EACjB,KAAK,qBAAqB,EAC3B,MAAM,2BAA2B,CAAC;AAMnC,OAAO,EAAE,aAAa,EAAkB,MAAM,gBAAgB,CAAC;AAM/D,MAAM,MAAM,uBAAuB,CACjC,cAAc,SAAS,qBAAqB,EAC5C,KAAK,IAEH;IACE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,SAAS,EAAE,CAClB,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,YAAY,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,KACrD,IAAI,CAAC;IACV,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;CACxC,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;IACvC,QAAQ,CAAC,eAAe,EAAE,iBAAiB,CACzC,cAAc,EACd,aAAa,CAAC,KAAK,CAAC,CACrB,CAAC;CACH,CAAC;AA6BN,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,KAAK,EACL,cAAc,SAAS,qBAAqB,EAE5C,aAAa,EAAE,aAAa,CAC1B,cAAc,EACd,aAAa,CAAC,KAAK,CAAC,EACpB,0BAA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,CAAC,EAAE;IACb,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAC;CAC7B,GACA,uBAAuB,CAAC,cAAc,EAAE,KAAK,CAAC,CA+OhD"}
|
|
@@ -21,7 +21,7 @@ function flatten(arr) {
|
|
|
21
21
|
return outArray;
|
|
22
22
|
}
|
|
23
23
|
function useSkipLimitPagination(loadableField, initialState) {
|
|
24
|
-
var _a;
|
|
24
|
+
var _a, _b;
|
|
25
25
|
const networkRequestOptions = {
|
|
26
26
|
suspendIfInFlight: true,
|
|
27
27
|
throwOnNetworkError: true,
|
|
@@ -99,13 +99,17 @@ function useSkipLimitPagination(loadableField, initialState) {
|
|
|
99
99
|
const loadedReferences = state === react_disposable_state_1.UNASSIGNED_STATE ? [] : state;
|
|
100
100
|
const mostRecentItem = loadedReferences[loadedReferences.length - 1];
|
|
101
101
|
const mostRecentFragmentReference = mostRecentItem === null || mostRecentItem === void 0 ? void 0 : mostRecentItem[0].getItemIfNotDisposed();
|
|
102
|
-
if (mostRecentItem && mostRecentFragmentReference === null) {
|
|
102
|
+
if (mostRecentItem != null && mostRecentFragmentReference === null) {
|
|
103
103
|
throw new Error('FragmentReference is unexpectedly disposed. \
|
|
104
104
|
This is indicative of a bug in Isograph.');
|
|
105
105
|
}
|
|
106
|
-
const networkRequestStatus = mostRecentFragmentReference
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
const networkRequestStatus = mostRecentFragmentReference != null
|
|
107
|
+
? {
|
|
108
|
+
mostRecentFragmentReference,
|
|
109
|
+
state: (0, PromiseWrapper_1.getPromiseState)(mostRecentFragmentReference.networkRequest),
|
|
110
|
+
}
|
|
111
|
+
: null;
|
|
112
|
+
const slicedFragmentReferences = ((_a = networkRequestStatus === null || networkRequestStatus === void 0 ? void 0 : networkRequestStatus.state) === null || _a === void 0 ? void 0 : _a.kind) === 'Ok'
|
|
109
113
|
? loadedReferences
|
|
110
114
|
: loadedReferences.slice(0, loadedReferences.length - 1);
|
|
111
115
|
const completedFragmentReferences = slicedFragmentReferences.map(([pointer]) => {
|
|
@@ -118,14 +122,14 @@ function useSkipLimitPagination(loadableField, initialState) {
|
|
|
118
122
|
});
|
|
119
123
|
const readOutDataAndRecords = completedFragmentReferences.map((fragmentReference) => (0, read_1.readButDoNotEvaluate)(environment, fragmentReference, networkRequestOptions));
|
|
120
124
|
(0, useReadAndSubscribe_1.useSubscribeToMultiple)(subscribeCompletedFragmentReferences(completedFragmentReferences));
|
|
121
|
-
if (
|
|
125
|
+
if (networkRequestStatus == null) {
|
|
122
126
|
return {
|
|
123
127
|
kind: 'Complete',
|
|
124
|
-
fetchMore: getFetchMore((
|
|
128
|
+
fetchMore: getFetchMore((_b = initialState === null || initialState === void 0 ? void 0 : initialState.skip) !== null && _b !== void 0 ? _b : 0),
|
|
125
129
|
results: [],
|
|
126
130
|
};
|
|
127
131
|
}
|
|
128
|
-
switch (networkRequestStatus.kind) {
|
|
132
|
+
switch (networkRequestStatus.state.kind) {
|
|
129
133
|
case 'Pending': {
|
|
130
134
|
const unsubscribe = (0, cache_1.subscribeToAnyChange)(environment, () => {
|
|
131
135
|
unsubscribe();
|
|
@@ -133,12 +137,12 @@ function useSkipLimitPagination(loadableField, initialState) {
|
|
|
133
137
|
});
|
|
134
138
|
return {
|
|
135
139
|
kind: 'Pending',
|
|
136
|
-
pendingFragment: mostRecentFragmentReference,
|
|
140
|
+
pendingFragment: networkRequestStatus.mostRecentFragmentReference,
|
|
137
141
|
results: readCompletedFragmentReferences(completedFragmentReferences),
|
|
138
142
|
};
|
|
139
143
|
}
|
|
140
144
|
case 'Err': {
|
|
141
|
-
throw networkRequestStatus.error;
|
|
145
|
+
throw networkRequestStatus.state.error;
|
|
142
146
|
}
|
|
143
147
|
case 'Ok': {
|
|
144
148
|
const results = readCompletedFragmentReferences(completedFragmentReferences);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@isograph/react",
|
|
3
|
-
"version": "0.0.0-main-
|
|
3
|
+
"version": "0.0.0-main-caa0e3a8",
|
|
4
4
|
"description": "Use Isograph with React",
|
|
5
5
|
"homepage": "https://isograph.dev",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
"author": "Isograph Labs",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@isograph/
|
|
12
|
-
"@isograph/disposable-
|
|
13
|
-
"@isograph/reference-counted-pointer": "0.0.0-main-
|
|
11
|
+
"@isograph/disposable-types": "0.0.0-main-caa0e3a8",
|
|
12
|
+
"@isograph/react-disposable-state": "0.0.0-main-caa0e3a8",
|
|
13
|
+
"@isograph/reference-counted-pointer": "0.0.0-main-caa0e3a8"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"react": "^18.0.0 || ^19.0.0"
|
package/src/core/cache.ts
CHANGED
|
@@ -70,7 +70,7 @@ export function getOrCreateItemInSuspenseCache<
|
|
|
70
70
|
* results.
|
|
71
71
|
*/
|
|
72
72
|
export function stableCopy<T>(value: T): T {
|
|
73
|
-
if (
|
|
73
|
+
if (value == null || typeof value !== 'object') {
|
|
74
74
|
return value;
|
|
75
75
|
}
|
|
76
76
|
if (isArray(value)) {
|
|
@@ -319,7 +319,7 @@ export function callSubscriptions(
|
|
|
319
319
|
if (
|
|
320
320
|
recordsEncounteredWhenNormalizing
|
|
321
321
|
.get(subscription.recordLink.__typename)
|
|
322
|
-
?.has(subscription.recordLink.__link)
|
|
322
|
+
?.has(subscription.recordLink.__link) != null
|
|
323
323
|
) {
|
|
324
324
|
logAnyError(
|
|
325
325
|
environment,
|
|
@@ -557,7 +557,7 @@ function revertOptimisticStoreLayerAndMaybeReplaceIfUndisposedIncomplete(
|
|
|
557
557
|
status: NetworkRequestStatusUndisposedIncomplete,
|
|
558
558
|
normalizeData: null | ((storeLayer: StoreLayerWithData) => void),
|
|
559
559
|
): NetworkRequestStatusUndisposedComplete {
|
|
560
|
-
if (status.optimistic) {
|
|
560
|
+
if (status.optimistic != null) {
|
|
561
561
|
revertOptimisticStoreLayerAndMaybeReplace(
|
|
562
562
|
environment,
|
|
563
563
|
status.optimistic,
|
|
@@ -321,7 +321,7 @@ function mergeLayersWithDataIntoBaseLayer(
|
|
|
321
321
|
baseStoreLayer: BaseStoreLayer,
|
|
322
322
|
) {
|
|
323
323
|
while (
|
|
324
|
-
storeLayerToMerge &&
|
|
324
|
+
storeLayerToMerge != null &&
|
|
325
325
|
storeLayerToMerge.kind !== 'OptimisticUpdaterStoreLayer'
|
|
326
326
|
) {
|
|
327
327
|
mergeDataLayer(baseStoreLayer.data, storeLayerToMerge.data);
|
package/src/core/read.ts
CHANGED
|
@@ -667,7 +667,7 @@ export function readLinkedFieldData(
|
|
|
667
667
|
const storeRecordName = getParentRecordKey(field, variables);
|
|
668
668
|
let value = storeRecord[storeRecordName];
|
|
669
669
|
|
|
670
|
-
if (field.condition) {
|
|
670
|
+
if (field.condition != null) {
|
|
671
671
|
const data = readData(field.condition.readerAst, root);
|
|
672
672
|
if (data.kind === 'MissingData') {
|
|
673
673
|
return {
|
package/src/core/startUpdate.ts
CHANGED
|
@@ -264,7 +264,7 @@ export function useConnectionSpecPagination<
|
|
|
264
264
|
const mostRecentFragmentReference =
|
|
265
265
|
mostRecentItem?.[0].getItemIfNotDisposed();
|
|
266
266
|
|
|
267
|
-
if (mostRecentItem && mostRecentFragmentReference === null) {
|
|
267
|
+
if (mostRecentItem != null && mostRecentFragmentReference === null) {
|
|
268
268
|
throw new Error(
|
|
269
269
|
'FragmentReference is unexpectedly disposed. \
|
|
270
270
|
This is indicative of a bug in Isograph.',
|
|
@@ -272,11 +272,15 @@ export function useConnectionSpecPagination<
|
|
|
272
272
|
}
|
|
273
273
|
|
|
274
274
|
const networkRequestStatus =
|
|
275
|
-
mostRecentFragmentReference
|
|
276
|
-
|
|
275
|
+
mostRecentFragmentReference != null
|
|
276
|
+
? {
|
|
277
|
+
mostRecentFragmentReference,
|
|
278
|
+
state: getPromiseState(mostRecentFragmentReference.networkRequest),
|
|
279
|
+
}
|
|
280
|
+
: null;
|
|
277
281
|
|
|
278
282
|
const slicedFragmentReferences =
|
|
279
|
-
networkRequestStatus?.kind === 'Ok'
|
|
283
|
+
networkRequestStatus?.state?.kind === 'Ok'
|
|
280
284
|
? loadedReferences
|
|
281
285
|
: loadedReferences.slice(0, loadedReferences.length - 1);
|
|
282
286
|
|
|
@@ -306,7 +310,7 @@ export function useConnectionSpecPagination<
|
|
|
306
310
|
subscribeCompletedFragmentReferences(completedFragmentReferences),
|
|
307
311
|
);
|
|
308
312
|
|
|
309
|
-
if (
|
|
313
|
+
if (networkRequestStatus == null) {
|
|
310
314
|
if (initialState?.hasNextPage ?? true) {
|
|
311
315
|
return {
|
|
312
316
|
kind: 'HasMoreRecords',
|
|
@@ -321,7 +325,7 @@ export function useConnectionSpecPagination<
|
|
|
321
325
|
}
|
|
322
326
|
}
|
|
323
327
|
|
|
324
|
-
switch (networkRequestStatus.kind) {
|
|
328
|
+
switch (networkRequestStatus.state.kind) {
|
|
325
329
|
case 'Pending': {
|
|
326
330
|
const unsubscribe = subscribeToAnyChange(environment, () => {
|
|
327
331
|
unsubscribe();
|
|
@@ -334,11 +338,11 @@ export function useConnectionSpecPagination<
|
|
|
334
338
|
return {
|
|
335
339
|
results: results.edges,
|
|
336
340
|
kind: 'Pending',
|
|
337
|
-
pendingFragment: mostRecentFragmentReference,
|
|
341
|
+
pendingFragment: networkRequestStatus.mostRecentFragmentReference,
|
|
338
342
|
};
|
|
339
343
|
}
|
|
340
344
|
case 'Err': {
|
|
341
|
-
throw networkRequestStatus.error;
|
|
345
|
+
throw networkRequestStatus.state.error;
|
|
342
346
|
}
|
|
343
347
|
case 'Ok': {
|
|
344
348
|
const results = readCompletedFragmentReferences(
|
|
@@ -248,7 +248,7 @@ export function useSkipLimitPagination<
|
|
|
248
248
|
const mostRecentFragmentReference =
|
|
249
249
|
mostRecentItem?.[0].getItemIfNotDisposed();
|
|
250
250
|
|
|
251
|
-
if (mostRecentItem && mostRecentFragmentReference === null) {
|
|
251
|
+
if (mostRecentItem != null && mostRecentFragmentReference === null) {
|
|
252
252
|
throw new Error(
|
|
253
253
|
'FragmentReference is unexpectedly disposed. \
|
|
254
254
|
This is indicative of a bug in Isograph.',
|
|
@@ -256,11 +256,15 @@ export function useSkipLimitPagination<
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
const networkRequestStatus =
|
|
259
|
-
mostRecentFragmentReference
|
|
260
|
-
|
|
259
|
+
mostRecentFragmentReference != null
|
|
260
|
+
? {
|
|
261
|
+
mostRecentFragmentReference,
|
|
262
|
+
state: getPromiseState(mostRecentFragmentReference.networkRequest),
|
|
263
|
+
}
|
|
264
|
+
: null;
|
|
261
265
|
|
|
262
266
|
const slicedFragmentReferences =
|
|
263
|
-
networkRequestStatus?.kind === 'Ok'
|
|
267
|
+
networkRequestStatus?.state?.kind === 'Ok'
|
|
264
268
|
? loadedReferences
|
|
265
269
|
: loadedReferences.slice(0, loadedReferences.length - 1);
|
|
266
270
|
|
|
@@ -290,7 +294,7 @@ export function useSkipLimitPagination<
|
|
|
290
294
|
subscribeCompletedFragmentReferences(completedFragmentReferences),
|
|
291
295
|
);
|
|
292
296
|
|
|
293
|
-
if (
|
|
297
|
+
if (networkRequestStatus == null) {
|
|
294
298
|
return {
|
|
295
299
|
kind: 'Complete',
|
|
296
300
|
fetchMore: getFetchMore(initialState?.skip ?? 0),
|
|
@@ -298,7 +302,7 @@ export function useSkipLimitPagination<
|
|
|
298
302
|
};
|
|
299
303
|
}
|
|
300
304
|
|
|
301
|
-
switch (networkRequestStatus.kind) {
|
|
305
|
+
switch (networkRequestStatus.state.kind) {
|
|
302
306
|
case 'Pending': {
|
|
303
307
|
const unsubscribe = subscribeToAnyChange(environment, () => {
|
|
304
308
|
unsubscribe();
|
|
@@ -307,12 +311,12 @@ export function useSkipLimitPagination<
|
|
|
307
311
|
|
|
308
312
|
return {
|
|
309
313
|
kind: 'Pending',
|
|
310
|
-
pendingFragment: mostRecentFragmentReference,
|
|
314
|
+
pendingFragment: networkRequestStatus.mostRecentFragmentReference,
|
|
311
315
|
results: readCompletedFragmentReferences(completedFragmentReferences),
|
|
312
316
|
};
|
|
313
317
|
}
|
|
314
318
|
case 'Err': {
|
|
315
|
-
throw networkRequestStatus.error;
|
|
319
|
+
throw networkRequestStatus.state.error;
|
|
316
320
|
}
|
|
317
321
|
case 'Ok': {
|
|
318
322
|
const results = readCompletedFragmentReferences(
|