@isograph/react 0.0.0-main-cd7d2fe9 → 0.0.0-main-a5a81588
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-typescript.log +1 -1
- package/dist/loadable-hooks/useImperativeLoadableField.d.ts +1 -2
- package/dist/loadable-hooks/useImperativeLoadableField.d.ts.map +1 -1
- package/dist/loadable-hooks/useImperativeLoadableField.js +1 -1
- package/dist/react/useImperativeReference.d.ts +1 -2
- package/dist/react/useImperativeReference.d.ts.map +1 -1
- package/dist/react/useImperativeReference.js +1 -2
- package/package.json +4 -4
- package/src/loadable-hooks/useImperativeLoadableField.ts +3 -5
- package/src/react/useImperativeReference.ts +6 -7
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @isograph/react@0.0.0-main-
|
|
2
|
+
> @isograph/react@0.0.0-main-a5a81588 compile-typescript /Users/runner/work/isograph/isograph/libs/isograph-react
|
|
3
3
|
> rm -rf dist/* && tsc -p tsconfig.pkg.json
|
|
4
4
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { UnassignedState } from '@isograph/react-disposable-state';
|
|
2
1
|
import { FetchOptions } from '../core/check';
|
|
3
2
|
import { ExtractParameters, FragmentReference } from '../core/FragmentReference';
|
|
4
3
|
import { LoadableField } from '../core/reader';
|
|
@@ -6,7 +5,7 @@ type UseImperativeLoadableFieldReturn<TReadFromStore extends {
|
|
|
6
5
|
data: object;
|
|
7
6
|
parameters: object;
|
|
8
7
|
}, TResult, TProvidedArgs extends object> = {
|
|
9
|
-
fragmentReference: FragmentReference<TReadFromStore, TResult> |
|
|
8
|
+
fragmentReference: FragmentReference<TReadFromStore, TResult> | null;
|
|
10
9
|
loadField: (args: Omit<ExtractParameters<TReadFromStore>, keyof TProvidedArgs> | void, fetchOptions?: FetchOptions<TResult>) => void;
|
|
11
10
|
};
|
|
12
11
|
export declare function useImperativeLoadableField<TReadFromStore extends {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useImperativeLoadableField.d.ts","sourceRoot":"","sources":["../../src/loadable-hooks/useImperativeLoadableField.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useImperativeLoadableField.d.ts","sourceRoot":"","sources":["../../src/loadable-hooks/useImperativeLoadableField.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAE/C,KAAK,gCAAgC,CACnC,cAAc,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EAC3D,OAAO,EACP,aAAa,SAAS,MAAM,IAC1B;IACF,iBAAiB,EAAE,iBAAiB,CAAC,cAAc,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACrE,SAAS,EAAE,CAGT,IAAI,EAAE,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,EAAE,MAAM,aAAa,CAAC,GAAG,IAAI,EACzE,YAAY,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,KACjC,IAAI,CAAC;CACX,CAAC;AAEF,wBAAgB,0BAA0B,CACxC,cAAc,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,EAC3D,OAAO,EACP,aAAa,SAAS,MAAM,EAE5B,aAAa,EAAE,aAAa,CAC1B,cAAc,EACd,OAAO,EACP,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,EAAE,MAAM,aAAa,CAAC,CAC7D,GACA,gCAAgC,CAAC,cAAc,EAAE,OAAO,EAAE,aAAa,CAAC,CAc1E"}
|
|
@@ -9,6 +9,6 @@ function useImperativeLoadableField(loadableField) {
|
|
|
9
9
|
const [_id, loader] = loadableField(args, fetchOptions !== null && fetchOptions !== void 0 ? fetchOptions : {});
|
|
10
10
|
setState(loader());
|
|
11
11
|
},
|
|
12
|
-
fragmentReference: state,
|
|
12
|
+
fragmentReference: state !== react_disposable_state_1.UNASSIGNED_STATE ? state : null,
|
|
13
13
|
};
|
|
14
14
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { UnassignedState } from '@isograph/react-disposable-state';
|
|
2
1
|
import { FetchOptions } from '../core/check';
|
|
3
2
|
import { IsographEntrypoint } from '../core/entrypoint';
|
|
4
3
|
import { ExtractParameters, FragmentReference } from '../core/FragmentReference';
|
|
@@ -8,7 +7,7 @@ export declare function useImperativeReference<TReadFromStore extends {
|
|
|
8
7
|
data: object;
|
|
9
8
|
startUpdate?: StartUpdate<object>;
|
|
10
9
|
}, TClientFieldValue>(entrypoint: IsographEntrypoint<TReadFromStore, TClientFieldValue>): {
|
|
11
|
-
fragmentReference: FragmentReference<TReadFromStore, TClientFieldValue> |
|
|
10
|
+
fragmentReference: FragmentReference<TReadFromStore, TClientFieldValue> | null;
|
|
12
11
|
loadFragmentReference: (variables: ExtractParameters<TReadFromStore>, fetchOptions?: FetchOptions<TClientFieldValue>) => void;
|
|
13
12
|
};
|
|
14
13
|
//# sourceMappingURL=useImperativeReference.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useImperativeReference.d.ts","sourceRoot":"","sources":["../../src/react/useImperativeReference.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useImperativeReference.d.ts","sourceRoot":"","sources":["../../src/react/useImperativeReference.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,2BAA2B,CAAC;AAInC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGlD,wBAAgB,sBAAsB,CACpC,cAAc,SAAS;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CACnC,EACD,iBAAiB,EAEjB,UAAU,EAAE,kBAAkB,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAChE;IACD,iBAAiB,EAAE,iBAAiB,CAClC,cAAc,EACd,iBAAiB,CAClB,GAAG,IAAI,CAAC;IACT,qBAAqB,EAAE,CACrB,SAAS,EAAE,iBAAiB,CAAC,cAAc,CAAC,EAC5C,YAAY,CAAC,EAAE,YAAY,CAAC,iBAAiB,CAAC,KAC3C,IAAI,CAAC;CACX,CAqCA"}
|
|
@@ -6,12 +6,11 @@ const IsographEnvironment_1 = require("../core/IsographEnvironment");
|
|
|
6
6
|
const makeNetworkRequest_1 = require("../core/makeNetworkRequest");
|
|
7
7
|
const PromiseWrapper_1 = require("../core/PromiseWrapper");
|
|
8
8
|
const IsographEnvironmentProvider_1 = require("./IsographEnvironmentProvider");
|
|
9
|
-
// TODO rename this to useImperativelyLoadedEntrypoint
|
|
10
9
|
function useImperativeReference(entrypoint) {
|
|
11
10
|
const { state, setState } = (0, react_disposable_state_1.useUpdatableDisposableState)();
|
|
12
11
|
const environment = (0, IsographEnvironmentProvider_1.useIsographEnvironment)();
|
|
13
12
|
return {
|
|
14
|
-
fragmentReference: state,
|
|
13
|
+
fragmentReference: state !== react_disposable_state_1.UNASSIGNED_STATE ? state : null,
|
|
15
14
|
loadFragmentReference: (variables, fetchOptions) => {
|
|
16
15
|
const [networkRequest, disposeNetworkRequest] = (0, makeNetworkRequest_1.maybeMakeNetworkRequest)(environment, entrypoint, variables, fetchOptions);
|
|
17
16
|
setState([
|
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-a5a81588",
|
|
4
4
|
"description": "Use Isograph with React",
|
|
5
5
|
"homepage": "https://isograph.dev",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"iso-watch": "cross-env ../../target/debug/isograph_cli --config ./isograph.config.json --watch"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@isograph/disposable-types": "0.0.0-main-
|
|
23
|
-
"@isograph/react-disposable-state": "0.0.0-main-
|
|
24
|
-
"@isograph/reference-counted-pointer": "0.0.0-main-
|
|
22
|
+
"@isograph/disposable-types": "0.0.0-main-a5a81588",
|
|
23
|
+
"@isograph/react-disposable-state": "0.0.0-main-a5a81588",
|
|
24
|
+
"@isograph/reference-counted-pointer": "0.0.0-main-a5a81588"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": "^18.0.0 || ^19.0.0"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
UNASSIGNED_STATE,
|
|
3
3
|
useUpdatableDisposableState,
|
|
4
4
|
} from '@isograph/react-disposable-state';
|
|
5
5
|
import { FetchOptions } from '../core/check';
|
|
@@ -14,9 +14,7 @@ type UseImperativeLoadableFieldReturn<
|
|
|
14
14
|
TResult,
|
|
15
15
|
TProvidedArgs extends object,
|
|
16
16
|
> = {
|
|
17
|
-
fragmentReference:
|
|
18
|
-
| FragmentReference<TReadFromStore, TResult>
|
|
19
|
-
| UnassignedState;
|
|
17
|
+
fragmentReference: FragmentReference<TReadFromStore, TResult> | null;
|
|
20
18
|
loadField: (
|
|
21
19
|
// TODO this should be void iff all args are provided by the query, like in
|
|
22
20
|
// useClientSideDefer.
|
|
@@ -47,6 +45,6 @@ export function useImperativeLoadableField<
|
|
|
47
45
|
const [_id, loader] = loadableField(args, fetchOptions ?? {});
|
|
48
46
|
setState(loader());
|
|
49
47
|
},
|
|
50
|
-
fragmentReference: state,
|
|
48
|
+
fragmentReference: state !== UNASSIGNED_STATE ? state : null,
|
|
51
49
|
};
|
|
52
50
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
-
|
|
2
|
+
UNASSIGNED_STATE,
|
|
3
3
|
useUpdatableDisposableState,
|
|
4
4
|
} from '@isograph/react-disposable-state';
|
|
5
5
|
import { FetchOptions } from '../core/check';
|
|
@@ -14,8 +14,6 @@ import { wrapResolvedValue } from '../core/PromiseWrapper';
|
|
|
14
14
|
import type { StartUpdate } from '../core/reader';
|
|
15
15
|
import { useIsographEnvironment } from './IsographEnvironmentProvider';
|
|
16
16
|
|
|
17
|
-
// TODO rename this to useImperativelyLoadedEntrypoint
|
|
18
|
-
|
|
19
17
|
export function useImperativeReference<
|
|
20
18
|
TReadFromStore extends {
|
|
21
19
|
parameters: object;
|
|
@@ -26,9 +24,10 @@ export function useImperativeReference<
|
|
|
26
24
|
>(
|
|
27
25
|
entrypoint: IsographEntrypoint<TReadFromStore, TClientFieldValue>,
|
|
28
26
|
): {
|
|
29
|
-
fragmentReference:
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
fragmentReference: FragmentReference<
|
|
28
|
+
TReadFromStore,
|
|
29
|
+
TClientFieldValue
|
|
30
|
+
> | null;
|
|
32
31
|
loadFragmentReference: (
|
|
33
32
|
variables: ExtractParameters<TReadFromStore>,
|
|
34
33
|
fetchOptions?: FetchOptions<TClientFieldValue>,
|
|
@@ -40,7 +39,7 @@ export function useImperativeReference<
|
|
|
40
39
|
>();
|
|
41
40
|
const environment = useIsographEnvironment();
|
|
42
41
|
return {
|
|
43
|
-
fragmentReference: state,
|
|
42
|
+
fragmentReference: state !== UNASSIGNED_STATE ? state : null,
|
|
44
43
|
loadFragmentReference: (
|
|
45
44
|
variables: ExtractParameters<TReadFromStore>,
|
|
46
45
|
fetchOptions?: FetchOptions<TClientFieldValue>,
|