@isograph/react 0.0.0-main-d12a2bc4 → 0.0.0-main-b0a65689
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/loadable-hooks/useConnectionSpecPagination.d.ts +4 -2
- package/dist/loadable-hooks/useConnectionSpecPagination.d.ts.map +1 -1
- package/dist/loadable-hooks/useConnectionSpecPagination.js +26 -12
- package/package.json +4 -4
- package/src/loadable-hooks/useConnectionSpecPagination.ts +29 -14
|
@@ -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-b0a65689 compile-libs /home/runner/work/isograph/isograph/libs/isograph-react
|
|
4
4
|
> rimraf dist && tsc -p tsconfig.pkg.json
|
|
5
5
|
|
|
@@ -6,10 +6,12 @@ export type UsePaginationReturnValue<TReadFromStore extends UnknownTReadFromStor
|
|
|
6
6
|
pendingFragment: FragmentReference<TReadFromStore, Connection<TItem>>;
|
|
7
7
|
results: ReadonlyArray<TItem>;
|
|
8
8
|
} | {
|
|
9
|
-
kind: '
|
|
9
|
+
kind: 'HasMoreRecords';
|
|
10
10
|
fetchMore: (count: number, fetchOptions?: FetchOptions<Connection<TItem>>) => void;
|
|
11
11
|
results: ReadonlyArray<TItem>;
|
|
12
|
-
|
|
12
|
+
} | {
|
|
13
|
+
kind: 'NoMoreRecords';
|
|
14
|
+
results: ReadonlyArray<TItem>;
|
|
13
15
|
};
|
|
14
16
|
export type PageInfo = {
|
|
15
17
|
readonly hasNextPage: boolean;
|
|
@@ -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,IAAI,EAAE,SAAS,CAAC;IAChB,eAAe,EAAE,iBAAiB,CAAC,cAAc,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;CAC/B,GACD;IACE,IAAI,EAAE,
|
|
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,IAAI,EAAE,SAAS,CAAC;IAChB,eAAe,EAAE,iBAAiB,CAAC,cAAc,EAAE,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;CAC/B,GACD;IACE,IAAI,EAAE,gBAAgB,CAAC;IACvB,SAAS,EAAE,CACT,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,YAAY,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,KAC3C,IAAI,CAAC;IACV,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;CAC/B,GACD;IACE,IAAI,EAAE,eAAe,CAAC;IACtB,OAAO,EAAE,aAAa,CAAC,KAAK,CAAC,CAAC;CAC/B,CAAC;AAwBN,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IAC1B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;CAC7B,CAAC;AAOF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF,wBAAgB,2BAA2B,CACzC,cAAc,SAAS,qBAAqB,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,CAiQjD"}
|
|
@@ -126,12 +126,19 @@ function useConnectionSpecPagination(loadableField, initialState) {
|
|
|
126
126
|
const readOutDataAndRecords = completedFragmentReferences.map((fragmentReference) => (0, read_1.readButDoNotEvaluate)(environment, fragmentReference, networkRequestOptions));
|
|
127
127
|
(0, useReadAndSubscribe_1.useSubscribeToMultiple)(subscribeCompletedFragmentReferences(completedFragmentReferences));
|
|
128
128
|
if (!networkRequestStatus) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
129
|
+
if ((_a = initialState === null || initialState === void 0 ? void 0 : initialState.hasNextPage) !== null && _a !== void 0 ? _a : true) {
|
|
130
|
+
return {
|
|
131
|
+
kind: 'HasMoreRecords',
|
|
132
|
+
fetchMore: getFetchMore((_b = initialState === null || initialState === void 0 ? void 0 : initialState.endCursor) !== null && _b !== void 0 ? _b : null),
|
|
133
|
+
results: [],
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
return {
|
|
138
|
+
kind: 'NoMoreRecords',
|
|
139
|
+
results: [],
|
|
140
|
+
};
|
|
141
|
+
}
|
|
135
142
|
}
|
|
136
143
|
switch (networkRequestStatus.kind) {
|
|
137
144
|
case 'Pending': {
|
|
@@ -151,12 +158,19 @@ function useConnectionSpecPagination(loadableField, initialState) {
|
|
|
151
158
|
}
|
|
152
159
|
case 'Ok': {
|
|
153
160
|
const results = readCompletedFragmentReferences(completedFragmentReferences);
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
161
|
+
if (results.pageInfo.hasNextPage) {
|
|
162
|
+
return {
|
|
163
|
+
kind: 'HasMoreRecords',
|
|
164
|
+
fetchMore: getFetchMore(results.pageInfo.endCursor),
|
|
165
|
+
results: results.edges,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
return {
|
|
170
|
+
kind: 'NoMoreRecords',
|
|
171
|
+
results: results.edges,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
160
174
|
}
|
|
161
175
|
}
|
|
162
176
|
}
|
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-b0a65689",
|
|
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/disposable-
|
|
12
|
-
"@isograph/
|
|
13
|
-
"@isograph/reference-counted-pointer": "0.0.0-main-
|
|
11
|
+
"@isograph/react-disposable-state": "0.0.0-main-b0a65689",
|
|
12
|
+
"@isograph/disposable-types": "0.0.0-main-b0a65689",
|
|
13
|
+
"@isograph/reference-counted-pointer": "0.0.0-main-b0a65689"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"react": "^18.0.0 || ^19.0.0"
|
|
@@ -35,13 +35,16 @@ export type UsePaginationReturnValue<
|
|
|
35
35
|
results: ReadonlyArray<TItem>;
|
|
36
36
|
}
|
|
37
37
|
| {
|
|
38
|
-
kind: '
|
|
38
|
+
kind: 'HasMoreRecords';
|
|
39
39
|
fetchMore: (
|
|
40
40
|
count: number,
|
|
41
41
|
fetchOptions?: FetchOptions<Connection<TItem>>,
|
|
42
42
|
) => void;
|
|
43
43
|
results: ReadonlyArray<TItem>;
|
|
44
|
-
|
|
44
|
+
}
|
|
45
|
+
| {
|
|
46
|
+
kind: 'NoMoreRecords';
|
|
47
|
+
results: ReadonlyArray<TItem>;
|
|
45
48
|
};
|
|
46
49
|
|
|
47
50
|
type LoadedFragmentReferences<
|
|
@@ -301,12 +304,18 @@ export function useConnectionSpecPagination<
|
|
|
301
304
|
);
|
|
302
305
|
|
|
303
306
|
if (!networkRequestStatus) {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
307
|
+
if (initialState?.hasNextPage ?? true) {
|
|
308
|
+
return {
|
|
309
|
+
kind: 'HasMoreRecords',
|
|
310
|
+
fetchMore: getFetchMore(initialState?.endCursor ?? null),
|
|
311
|
+
results: [],
|
|
312
|
+
};
|
|
313
|
+
} else {
|
|
314
|
+
return {
|
|
315
|
+
kind: 'NoMoreRecords',
|
|
316
|
+
results: [],
|
|
317
|
+
};
|
|
318
|
+
}
|
|
310
319
|
}
|
|
311
320
|
|
|
312
321
|
switch (networkRequestStatus.kind) {
|
|
@@ -333,12 +342,18 @@ export function useConnectionSpecPagination<
|
|
|
333
342
|
completedFragmentReferences,
|
|
334
343
|
);
|
|
335
344
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
345
|
+
if (results.pageInfo.hasNextPage) {
|
|
346
|
+
return {
|
|
347
|
+
kind: 'HasMoreRecords',
|
|
348
|
+
fetchMore: getFetchMore(results.pageInfo.endCursor),
|
|
349
|
+
results: results.edges,
|
|
350
|
+
};
|
|
351
|
+
} else {
|
|
352
|
+
return {
|
|
353
|
+
kind: 'NoMoreRecords',
|
|
354
|
+
results: results.edges,
|
|
355
|
+
};
|
|
356
|
+
}
|
|
342
357
|
}
|
|
343
358
|
}
|
|
344
359
|
}
|