@isograph/react 0.0.0-main-63c03947 → 0.0.0-main-c1486166
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 +4 -0
- package/dist/core/FragmentReference.d.ts +1 -1
- package/dist/core/FragmentReference.d.ts.map +1 -1
- package/dist/core/IsographEnvironment.d.ts +4 -4
- package/dist/core/IsographEnvironment.d.ts.map +1 -1
- package/dist/core/areEqualWithDeepComparison.d.ts.map +1 -1
- package/dist/core/cache.d.ts +4 -4
- package/dist/core/cache.d.ts.map +1 -1
- package/dist/core/cache.js +3 -3
- package/dist/core/componentCache.d.ts +1 -1
- package/dist/core/componentCache.d.ts.map +1 -1
- package/dist/core/componentCache.js +2 -2
- package/dist/core/garbageCollection.d.ts +1 -1
- package/dist/core/garbageCollection.d.ts.map +1 -1
- package/dist/core/garbageCollection.js +1 -1
- package/dist/core/logging.d.ts +5 -5
- package/dist/core/logging.d.ts.map +1 -1
- package/dist/core/makeNetworkRequest.d.ts +1 -1
- package/dist/core/makeNetworkRequest.d.ts.map +1 -1
- package/dist/core/makeNetworkRequest.js +4 -4
- package/dist/core/read.d.ts +1 -1
- package/dist/core/read.d.ts.map +1 -1
- package/dist/core/read.js +1 -1
- package/dist/core/reader.d.ts +3 -3
- package/dist/core/reader.d.ts.map +1 -1
- package/dist/loadable-hooks/useClientSideDefer.d.ts +1 -1
- package/dist/loadable-hooks/useClientSideDefer.d.ts.map +1 -1
- package/dist/loadable-hooks/useClientSideDefer.js +2 -2
- package/dist/loadable-hooks/useConnectionSpecPagination.d.ts +1 -1
- package/dist/loadable-hooks/useConnectionSpecPagination.d.ts.map +1 -1
- package/dist/loadable-hooks/useImperativeLoadableField.d.ts +2 -2
- package/dist/loadable-hooks/useImperativeLoadableField.d.ts.map +1 -1
- package/dist/loadable-hooks/useSkipLimitPagination.d.ts +2 -2
- package/dist/loadable-hooks/useSkipLimitPagination.d.ts.map +1 -1
- package/dist/loadable-hooks/useSkipLimitPagination.js +5 -5
- package/dist/react/FragmentReader.d.ts.map +1 -1
- package/dist/react/IsographEnvironmentProvider.d.ts.map +1 -1
- package/dist/react/useImperativeReference.d.ts +2 -2
- package/dist/react/useImperativeReference.d.ts.map +1 -1
- package/dist/react/useImperativeReference.js +1 -1
- package/dist/react/useLazyReference.d.ts +2 -2
- package/dist/react/useLazyReference.d.ts.map +1 -1
- package/dist/react/useLazyReference.js +2 -2
- package/dist/react/useReadAndSubscribe.d.ts +1 -1
- package/dist/react/useReadAndSubscribe.d.ts.map +1 -1
- package/dist/react/useReadAndSubscribe.js +2 -2
- package/dist/react/useRerenderOnChange.d.ts +1 -1
- package/dist/react/useRerenderOnChange.d.ts.map +1 -1
- package/dist/react/useResult.d.ts +1 -1
- package/dist/react/useResult.d.ts.map +1 -1
- package/dist/react/useResult.js +3 -3
- package/package.json +6 -6
- package/src/core/FragmentReference.ts +1 -1
- package/src/core/IsographEnvironment.ts +4 -4
- package/src/core/areEqualWithDeepComparison.ts +1 -0
- package/src/core/cache.ts +19 -19
- package/src/core/componentCache.ts +4 -4
- package/src/core/garbageCollection.ts +3 -3
- package/src/core/logging.ts +9 -9
- package/src/core/makeNetworkRequest.ts +4 -4
- package/src/core/read.ts +5 -5
- package/src/core/reader.ts +9 -9
- package/src/loadable-hooks/useClientSideDefer.ts +4 -4
- package/src/loadable-hooks/useConnectionSpecPagination.ts +1 -1
- package/src/loadable-hooks/useImperativeLoadableField.ts +5 -5
- package/src/loadable-hooks/useSkipLimitPagination.ts +11 -9
- package/src/react/FragmentReader.tsx +1 -1
- package/src/react/IsographEnvironmentProvider.tsx +1 -1
- package/src/react/useImperativeReference.ts +3 -3
- package/src/react/useLazyReference.ts +6 -6
- package/src/react/useReadAndSubscribe.ts +4 -4
- package/src/react/useRerenderOnChange.ts +2 -2
- package/src/react/useResult.ts +7 -7
- package/src/tests/garbageCollection.test.ts +8 -7
package/dist/react/useResult.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useResult = useResult;
|
|
4
4
|
exports.maybeUnwrapNetworkRequest = maybeUnwrapNetworkRequest;
|
|
5
|
-
const IsographEnvironmentProvider_1 = require("../react/IsographEnvironmentProvider");
|
|
6
5
|
const componentCache_1 = require("../core/componentCache");
|
|
7
|
-
const useReadAndSubscribe_1 = require("./useReadAndSubscribe");
|
|
8
|
-
const read_1 = require("../core/read");
|
|
9
6
|
const PromiseWrapper_1 = require("../core/PromiseWrapper");
|
|
7
|
+
const read_1 = require("../core/read");
|
|
8
|
+
const IsographEnvironmentProvider_1 = require("../react/IsographEnvironmentProvider");
|
|
9
|
+
const useReadAndSubscribe_1 = require("./useReadAndSubscribe");
|
|
10
10
|
function useResult(fragmentReference, partialNetworkRequestOptions) {
|
|
11
11
|
const environment = (0, IsographEnvironmentProvider_1.useIsographEnvironment)();
|
|
12
12
|
const networkRequestOptions = (0, read_1.getNetworkRequestOptionsWithDefaults)(partialNetworkRequestOptions);
|
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-c1486166",
|
|
4
4
|
"description": "Use Isograph with React",
|
|
5
5
|
"homepage": "https://isograph.dev",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -8,20 +8,20 @@
|
|
|
8
8
|
"author": "Isograph Labs",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
|
-
"compile": "rm -rf dist/* && tsc -p tsconfig.pkg.json",
|
|
11
|
+
"compile-typescript": "rm -rf dist/* && tsc -p tsconfig.pkg.json",
|
|
12
12
|
"compile-watch": "tsc -p tsconfig.pkg.json --watch",
|
|
13
13
|
"test": "vitest run",
|
|
14
14
|
"test-watch": "vitest watch",
|
|
15
15
|
"coverage": "vitest run --coverage",
|
|
16
|
-
"prepack": "pnpm run test && pnpm run compile",
|
|
16
|
+
"prepack": "pnpm run test && pnpm run compile-typescript",
|
|
17
17
|
"tsc": "tsc",
|
|
18
18
|
"iso": "../../target/debug/isograph_cli --config ./isograph.config.json",
|
|
19
19
|
"iso-watch": "../../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-c1486166",
|
|
23
|
+
"@isograph/react-disposable-state": "0.0.0-main-c1486166",
|
|
24
|
+
"@isograph/reference-counted-pointer": "0.0.0-main-c1486166"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"react": "18.3.1"
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ParentCache } from '@isograph/react-disposable-state';
|
|
2
|
-
import {
|
|
3
|
-
import { WithEncounteredRecords } from './read';
|
|
2
|
+
import { IsographEntrypoint } from './entrypoint';
|
|
4
3
|
import { FragmentReference, Variables } from './FragmentReference';
|
|
4
|
+
import { RetainedQuery } from './garbageCollection';
|
|
5
|
+
import { LogFunction, WrappedLogFunction } from './logging';
|
|
5
6
|
import { PromiseWrapper, wrapPromise } from './PromiseWrapper';
|
|
6
|
-
import {
|
|
7
|
+
import { WithEncounteredRecords } from './read';
|
|
7
8
|
import type { ReaderAst } from './reader';
|
|
8
|
-
import { LogFunction, WrappedLogFunction } from './logging';
|
|
9
9
|
|
|
10
10
|
export type ComponentOrFieldName = string;
|
|
11
11
|
export type StringifiedArgs = string;
|
package/src/core/cache.ts
CHANGED
|
@@ -3,38 +3,38 @@ import {
|
|
|
3
3
|
ItemCleanupPair,
|
|
4
4
|
ParentCache,
|
|
5
5
|
} from '@isograph/react-disposable-state';
|
|
6
|
-
import {
|
|
7
|
-
DataId,
|
|
8
|
-
Link,
|
|
9
|
-
ROOT_ID,
|
|
10
|
-
StoreRecord,
|
|
11
|
-
type IsographEnvironment,
|
|
12
|
-
DataTypeValue,
|
|
13
|
-
getLink,
|
|
14
|
-
FragmentSubscription,
|
|
15
|
-
type TypeName,
|
|
16
|
-
} from './IsographEnvironment';
|
|
17
6
|
import {
|
|
18
7
|
IsographEntrypoint,
|
|
19
|
-
type NormalizationAstNodes,
|
|
20
8
|
NormalizationInlineFragment,
|
|
21
9
|
NormalizationLinkedField,
|
|
22
10
|
NormalizationScalarField,
|
|
23
11
|
RefetchQueryNormalizationArtifactWrapper,
|
|
12
|
+
type NormalizationAstNodes,
|
|
24
13
|
} from '../core/entrypoint';
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import { WithEncounteredRecords, readButDoNotEvaluate } from './read';
|
|
14
|
+
import { mergeObjectsUsingReaderAst } from './areEqualWithDeepComparison';
|
|
15
|
+
import { FetchOptions } from './check';
|
|
28
16
|
import {
|
|
17
|
+
ExtractParameters,
|
|
29
18
|
FragmentReference,
|
|
30
19
|
Variables,
|
|
31
|
-
ExtractParameters,
|
|
32
20
|
} from './FragmentReference';
|
|
33
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
DataId,
|
|
23
|
+
DataTypeValue,
|
|
24
|
+
FragmentSubscription,
|
|
25
|
+
getLink,
|
|
26
|
+
Link,
|
|
27
|
+
ROOT_ID,
|
|
28
|
+
StoreRecord,
|
|
29
|
+
type IsographEnvironment,
|
|
30
|
+
type TypeName,
|
|
31
|
+
} from './IsographEnvironment';
|
|
32
|
+
import { logMessage } from './logging';
|
|
34
33
|
import { maybeMakeNetworkRequest } from './makeNetworkRequest';
|
|
35
34
|
import { wrapResolvedValue } from './PromiseWrapper';
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
35
|
+
import { readButDoNotEvaluate, WithEncounteredRecords } from './read';
|
|
36
|
+
import { ReaderLinkedField, ReaderScalarField, type ReaderAst } from './reader';
|
|
37
|
+
import { Argument, ArgumentValue } from './util';
|
|
38
38
|
|
|
39
39
|
export const TYPENAME_FIELD_NAME = '__typename';
|
|
40
40
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { useReadAndSubscribe } from '../react/useReadAndSubscribe';
|
|
1
2
|
import { stableCopy } from './cache';
|
|
2
|
-
import { IsographEnvironment } from './IsographEnvironment';
|
|
3
3
|
import { FragmentReference } from './FragmentReference';
|
|
4
|
-
import {
|
|
5
|
-
import { NetworkRequestReaderOptions } from './read';
|
|
6
|
-
import { readPromise } from './PromiseWrapper';
|
|
4
|
+
import { IsographEnvironment } from './IsographEnvironment';
|
|
7
5
|
import { logMessage } from './logging';
|
|
6
|
+
import { readPromise } from './PromiseWrapper';
|
|
7
|
+
import { NetworkRequestReaderOptions } from './read';
|
|
8
8
|
|
|
9
9
|
export function getOrCreateCachedComponent(
|
|
10
10
|
environment: IsographEnvironment,
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
+
import { getParentRecordKey } from './cache';
|
|
2
|
+
import { NormalizationAstNodes } from './entrypoint';
|
|
1
3
|
import { Variables } from './FragmentReference';
|
|
2
4
|
import {
|
|
5
|
+
assertLink,
|
|
3
6
|
DataId,
|
|
4
7
|
IsographEnvironment,
|
|
5
8
|
IsographStore,
|
|
6
9
|
StoreRecord,
|
|
7
|
-
assertLink,
|
|
8
10
|
type Link,
|
|
9
11
|
type TypeName,
|
|
10
12
|
} from './IsographEnvironment';
|
|
11
|
-
import { getParentRecordKey } from './cache';
|
|
12
|
-
import { NormalizationAstNodes } from './entrypoint';
|
|
13
13
|
|
|
14
14
|
export type RetainedQuery = {
|
|
15
15
|
readonly normalizationAst: NormalizationAstNodes;
|
package/src/core/logging.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { CleanupFn } from '@isograph/disposable-types';
|
|
2
|
+
import { NetworkResponseObject, type EncounteredIds } from './cache';
|
|
3
|
+
import { CheckResult } from './check';
|
|
4
|
+
import {
|
|
5
|
+
IsographEntrypoint,
|
|
6
|
+
RefetchQueryNormalizationArtifact,
|
|
7
|
+
type NormalizationAstNodes,
|
|
8
|
+
} from './entrypoint';
|
|
9
|
+
import { FragmentReference, Variables } from './FragmentReference';
|
|
2
10
|
import {
|
|
3
11
|
IsographEnvironment,
|
|
4
12
|
IsographStore,
|
|
5
13
|
StoreRecord,
|
|
6
14
|
type Link,
|
|
7
15
|
} from './IsographEnvironment';
|
|
8
|
-
import {
|
|
9
|
-
IsographEntrypoint,
|
|
10
|
-
type NormalizationAstNodes,
|
|
11
|
-
RefetchQueryNormalizationArtifact,
|
|
12
|
-
} from './entrypoint';
|
|
13
|
-
import { FragmentReference, Variables } from './FragmentReference';
|
|
14
|
-
import { NetworkResponseObject, type EncounteredIds } from './cache';
|
|
15
|
-
import { Arguments } from './util';
|
|
16
16
|
import { ReadDataResult } from './read';
|
|
17
|
-
import {
|
|
17
|
+
import { Arguments } from './util';
|
|
18
18
|
|
|
19
19
|
export type LogMessage =
|
|
20
20
|
| {
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { ItemCleanupPair } from '@isograph/disposable-types';
|
|
2
|
+
import { normalizeData } from './cache';
|
|
3
|
+
import { check, DEFAULT_SHOULD_FETCH_VALUE, FetchOptions } from './check';
|
|
4
|
+
import { getOrCreateCachedComponent } from './componentCache';
|
|
2
5
|
import {
|
|
3
6
|
IsographEntrypoint,
|
|
4
7
|
RefetchQueryNormalizationArtifact,
|
|
@@ -11,17 +14,14 @@ import {
|
|
|
11
14
|
unretainQuery,
|
|
12
15
|
} from './garbageCollection';
|
|
13
16
|
import { IsographEnvironment, Link, ROOT_ID } from './IsographEnvironment';
|
|
17
|
+
import { logMessage } from './logging';
|
|
14
18
|
import {
|
|
15
19
|
AnyError,
|
|
16
20
|
PromiseWrapper,
|
|
17
21
|
wrapPromise,
|
|
18
22
|
wrapResolvedValue,
|
|
19
23
|
} from './PromiseWrapper';
|
|
20
|
-
import { normalizeData } from './cache';
|
|
21
|
-
import { logMessage } from './logging';
|
|
22
|
-
import { check, DEFAULT_SHOULD_FETCH_VALUE, FetchOptions } from './check';
|
|
23
24
|
import { readButDoNotEvaluate } from './read';
|
|
24
|
-
import { getOrCreateCachedComponent } from './componentCache';
|
|
25
25
|
|
|
26
26
|
let networkRequestId = 0;
|
|
27
27
|
|
package/src/core/read.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
|
+
import { CleanupFn } from '@isograph/disposable-types';
|
|
1
2
|
import {
|
|
2
3
|
getParentRecordKey,
|
|
3
4
|
insertIfNotExists,
|
|
4
5
|
onNextChangeToRecord,
|
|
5
6
|
type EncounteredIds,
|
|
6
7
|
} from './cache';
|
|
8
|
+
import { FetchOptions } from './check';
|
|
7
9
|
import { getOrCreateCachedComponent } from './componentCache';
|
|
8
10
|
import {
|
|
9
11
|
IsographEntrypoint,
|
|
10
12
|
RefetchQueryNormalizationArtifactWrapper,
|
|
11
13
|
} from './entrypoint';
|
|
12
14
|
import {
|
|
13
|
-
FragmentReference,
|
|
14
|
-
Variables,
|
|
15
15
|
ExtractData,
|
|
16
16
|
ExtractParameters,
|
|
17
|
+
FragmentReference,
|
|
18
|
+
Variables,
|
|
17
19
|
} from './FragmentReference';
|
|
18
20
|
import {
|
|
19
21
|
assertLink,
|
|
@@ -21,6 +23,7 @@ import {
|
|
|
21
23
|
IsographEnvironment,
|
|
22
24
|
type Link,
|
|
23
25
|
} from './IsographEnvironment';
|
|
26
|
+
import { logMessage } from './logging';
|
|
24
27
|
import { maybeMakeNetworkRequest } from './makeNetworkRequest';
|
|
25
28
|
import {
|
|
26
29
|
getPromiseState,
|
|
@@ -32,9 +35,6 @@ import {
|
|
|
32
35
|
} from './PromiseWrapper';
|
|
33
36
|
import { ReaderAst } from './reader';
|
|
34
37
|
import { Arguments } from './util';
|
|
35
|
-
import { logMessage } from './logging';
|
|
36
|
-
import { CleanupFn } from '@isograph/disposable-types';
|
|
37
|
-
import { FetchOptions } from './check';
|
|
38
38
|
|
|
39
39
|
export type WithEncounteredRecords<T> = {
|
|
40
40
|
readonly encounteredRecords: EncounteredIds;
|
package/src/core/reader.ts
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { Factory } from '@isograph/disposable-types';
|
|
2
|
+
import { FetchOptions } from './check';
|
|
3
|
+
import {
|
|
4
|
+
IsographEntrypoint,
|
|
5
|
+
IsographEntrypointLoader,
|
|
6
|
+
RefetchQueryNormalizationArtifact,
|
|
7
|
+
RefetchQueryNormalizationArtifactWrapper,
|
|
8
|
+
} from './entrypoint';
|
|
2
9
|
import {
|
|
3
|
-
FragmentReference,
|
|
4
|
-
ExtractParameters,
|
|
5
10
|
ExtractData,
|
|
11
|
+
ExtractParameters,
|
|
12
|
+
FragmentReference,
|
|
6
13
|
} from './FragmentReference';
|
|
7
14
|
import {
|
|
8
15
|
ComponentOrFieldName,
|
|
9
16
|
IsographEnvironment,
|
|
10
17
|
type Link,
|
|
11
18
|
} from './IsographEnvironment';
|
|
12
|
-
import {
|
|
13
|
-
IsographEntrypoint,
|
|
14
|
-
IsographEntrypointLoader,
|
|
15
|
-
RefetchQueryNormalizationArtifact,
|
|
16
|
-
RefetchQueryNormalizationArtifactWrapper,
|
|
17
|
-
} from './entrypoint';
|
|
18
19
|
import { Arguments } from './util';
|
|
19
|
-
import { FetchOptions } from './check';
|
|
20
20
|
|
|
21
21
|
export type TopLevelReaderArtifact<
|
|
22
22
|
TReadFromStore extends { parameters: object; data: object },
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { useLazyDisposableState } from '@isograph/react-disposable-state';
|
|
2
|
+
import { getOrCreateItemInSuspenseCache } from '../core/cache';
|
|
3
|
+
import { FetchOptions } from '../core/check';
|
|
1
4
|
import {
|
|
2
5
|
ExtractParameters,
|
|
3
6
|
FragmentReference,
|
|
4
7
|
} from '../core/FragmentReference';
|
|
5
|
-
import { useIsographEnvironment } from '../react/IsographEnvironmentProvider';
|
|
6
|
-
import { getOrCreateItemInSuspenseCache } from '../core/cache';
|
|
7
|
-
import { useLazyDisposableState } from '@isograph/react-disposable-state';
|
|
8
8
|
import { LoadableField } from '../core/reader';
|
|
9
|
-
import {
|
|
9
|
+
import { useIsographEnvironment } from '../react/IsographEnvironmentProvider';
|
|
10
10
|
|
|
11
11
|
export function useClientSideDefer<
|
|
12
12
|
TReadFromStore extends { data: object; parameters: object },
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
} from '@isograph/reference-counted-pointer';
|
|
10
10
|
import { useState } from 'react';
|
|
11
11
|
import { subscribeToAnyChange } from '../core/cache';
|
|
12
|
+
import { FetchOptions } from '../core/check';
|
|
12
13
|
import { FragmentReference } from '../core/FragmentReference';
|
|
13
14
|
import { getPromiseState, readPromise } from '../core/PromiseWrapper';
|
|
14
15
|
import {
|
|
@@ -19,7 +20,6 @@ import { LoadableField, type ReaderAst } from '../core/reader';
|
|
|
19
20
|
import { useIsographEnvironment } from '../react/IsographEnvironmentProvider';
|
|
20
21
|
import { useSubscribeToMultiple } from '../react/useReadAndSubscribe';
|
|
21
22
|
import { maybeUnwrapNetworkRequest } from '../react/useResult';
|
|
22
|
-
import { FetchOptions } from '../core/check';
|
|
23
23
|
|
|
24
24
|
type UsePaginationReturnValue<
|
|
25
25
|
TReadFromStore extends { parameters: object; data: object },
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ExtractParameters,
|
|
3
|
-
FragmentReference,
|
|
4
|
-
} from '../core/FragmentReference';
|
|
5
1
|
import {
|
|
6
2
|
UnassignedState,
|
|
7
3
|
useUpdatableDisposableState,
|
|
8
4
|
} from '@isograph/react-disposable-state';
|
|
9
|
-
import { LoadableField } from '../core/reader';
|
|
10
5
|
import { FetchOptions } from '../core/check';
|
|
6
|
+
import {
|
|
7
|
+
ExtractParameters,
|
|
8
|
+
FragmentReference,
|
|
9
|
+
} from '../core/FragmentReference';
|
|
10
|
+
import { LoadableField } from '../core/reader';
|
|
11
11
|
|
|
12
12
|
type UseImperativeLoadableFieldReturn<
|
|
13
13
|
TReadFromStore extends { data: object; parameters: object },
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import { LoadableField, type ReaderAst } from '../core/reader';
|
|
2
|
-
import { useIsographEnvironment } from '../react/IsographEnvironmentProvider';
|
|
3
1
|
import { ItemCleanupPair } from '@isograph/disposable-types';
|
|
4
|
-
import { FragmentReference } from '../core/FragmentReference';
|
|
5
|
-
import { maybeUnwrapNetworkRequest } from '../react/useResult';
|
|
6
|
-
import { readButDoNotEvaluate } from '../core/read';
|
|
7
|
-
import { subscribeToAnyChange } from '../core/cache';
|
|
8
|
-
import { useState } from 'react';
|
|
9
2
|
import {
|
|
10
3
|
UNASSIGNED_STATE,
|
|
11
4
|
useUpdatableDisposableState,
|
|
@@ -14,10 +7,19 @@ import {
|
|
|
14
7
|
createReferenceCountedPointer,
|
|
15
8
|
ReferenceCountedPointer,
|
|
16
9
|
} from '@isograph/reference-counted-pointer';
|
|
10
|
+
import { useState } from 'react';
|
|
11
|
+
import { subscribeToAnyChange } from '../core/cache';
|
|
12
|
+
import { FetchOptions } from '../core/check';
|
|
13
|
+
import { FragmentReference } from '../core/FragmentReference';
|
|
17
14
|
import { getPromiseState, readPromise } from '../core/PromiseWrapper';
|
|
18
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
readButDoNotEvaluate,
|
|
17
|
+
type WithEncounteredRecords,
|
|
18
|
+
} from '../core/read';
|
|
19
|
+
import { LoadableField, type ReaderAst } from '../core/reader';
|
|
20
|
+
import { useIsographEnvironment } from '../react/IsographEnvironmentProvider';
|
|
19
21
|
import { useSubscribeToMultiple } from '../react/useReadAndSubscribe';
|
|
20
|
-
import {
|
|
22
|
+
import { maybeUnwrapNetworkRequest } from '../react/useResult';
|
|
21
23
|
|
|
22
24
|
type UseSkipLimitReturnValue<
|
|
23
25
|
TReadFromStore extends { data: object; parameters: object },
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ExtractReadFromStore, IsographEntrypoint } from '../core/entrypoint';
|
|
3
3
|
import { FragmentReference } from '../core/FragmentReference';
|
|
4
|
-
import { useResult } from './useResult';
|
|
5
4
|
import { NetworkRequestReaderOptions } from '../core/read';
|
|
5
|
+
import { useResult } from './useResult';
|
|
6
6
|
|
|
7
7
|
type IsExactlyIntrinsicAttributes<T> = T extends JSX.IntrinsicAttributes
|
|
8
8
|
? JSX.IntrinsicAttributes extends T
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { createContext, ReactNode, useContext } from 'react';
|
|
3
3
|
import { type IsographEnvironment } from '../core/IsographEnvironment';
|
|
4
4
|
|
|
5
5
|
export const IsographEnvironmentContext =
|
|
@@ -2,16 +2,16 @@ import {
|
|
|
2
2
|
UnassignedState,
|
|
3
3
|
useUpdatableDisposableState,
|
|
4
4
|
} from '@isograph/react-disposable-state';
|
|
5
|
+
import { FetchOptions } from '../core/check';
|
|
5
6
|
import { IsographEntrypoint } from '../core/entrypoint';
|
|
6
7
|
import {
|
|
7
|
-
FragmentReference,
|
|
8
8
|
ExtractParameters,
|
|
9
|
+
FragmentReference,
|
|
9
10
|
} from '../core/FragmentReference';
|
|
10
|
-
import { useIsographEnvironment } from './IsographEnvironmentProvider';
|
|
11
11
|
import { ROOT_ID } from '../core/IsographEnvironment';
|
|
12
12
|
import { maybeMakeNetworkRequest } from '../core/makeNetworkRequest';
|
|
13
13
|
import { wrapResolvedValue } from '../core/PromiseWrapper';
|
|
14
|
-
import {
|
|
14
|
+
import { useIsographEnvironment } from './IsographEnvironmentProvider';
|
|
15
15
|
|
|
16
16
|
// TODO rename this to useImperativelyLoadedEntrypoint
|
|
17
17
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { useLazyDisposableState } from '@isograph/react-disposable-state';
|
|
2
|
+
import { getOrCreateCacheForArtifact } from '../core/cache';
|
|
3
|
+
import { FetchOptions } from '../core/check';
|
|
4
|
+
import { IsographEntrypoint } from '../core/entrypoint';
|
|
1
5
|
import {
|
|
2
|
-
FragmentReference,
|
|
3
6
|
ExtractParameters,
|
|
7
|
+
FragmentReference,
|
|
4
8
|
} from '../core/FragmentReference';
|
|
5
|
-
import { useIsographEnvironment } from './IsographEnvironmentProvider';
|
|
6
|
-
import { IsographEntrypoint } from '../core/entrypoint';
|
|
7
|
-
import { getOrCreateCacheForArtifact } from '../core/cache';
|
|
8
|
-
import { useLazyDisposableState } from '@isograph/react-disposable-state';
|
|
9
9
|
import { logMessage } from '../core/logging';
|
|
10
|
-
import {
|
|
10
|
+
import { useIsographEnvironment } from './IsographEnvironmentProvider';
|
|
11
11
|
|
|
12
12
|
export function useLazyReference<
|
|
13
13
|
TReadFromStore extends { parameters: object; data: object },
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
|
+
import { subscribe } from '../core/cache';
|
|
2
3
|
import {
|
|
4
|
+
ExtractData,
|
|
3
5
|
FragmentReference,
|
|
4
6
|
stableIdForFragmentReference,
|
|
5
|
-
ExtractData,
|
|
6
7
|
} from '../core/FragmentReference';
|
|
7
8
|
import {
|
|
8
9
|
NetworkRequestReaderOptions,
|
|
9
10
|
readButDoNotEvaluate,
|
|
10
11
|
WithEncounteredRecords,
|
|
11
12
|
} from '../core/read';
|
|
12
|
-
import { useRerenderOnChange } from './useRerenderOnChange';
|
|
13
|
-
import { useIsographEnvironment } from './IsographEnvironmentProvider';
|
|
14
|
-
import { subscribe } from '../core/cache';
|
|
15
13
|
import type { ReaderAst } from '../core/reader';
|
|
14
|
+
import { useIsographEnvironment } from './IsographEnvironmentProvider';
|
|
15
|
+
import { useRerenderOnChange } from './useRerenderOnChange';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Read the data from a fragment reference and subscribe to updates.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { subscribe } from '../core/cache';
|
|
3
|
-
import { WithEncounteredRecords } from '../core/read';
|
|
4
3
|
import { FragmentReference } from '../core/FragmentReference';
|
|
5
|
-
import {
|
|
4
|
+
import { WithEncounteredRecords } from '../core/read';
|
|
6
5
|
import type { ReaderAst } from '../core/reader';
|
|
6
|
+
import { useIsographEnvironment } from './IsographEnvironmentProvider';
|
|
7
7
|
|
|
8
8
|
// TODO add unit tests for this. Add integration tests that test
|
|
9
9
|
// behavior when the encounteredRecords underneath a fragment change.
|
package/src/react/useResult.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { useIsographEnvironment } from '../react/IsographEnvironmentProvider';
|
|
2
|
-
import { FragmentReference } from '../core/FragmentReference';
|
|
3
1
|
import { getOrCreateCachedComponent } from '../core/componentCache';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
getNetworkRequestOptionsWithDefaults,
|
|
7
|
-
NetworkRequestReaderOptions,
|
|
8
|
-
} from '../core/read';
|
|
2
|
+
import { FragmentReference } from '../core/FragmentReference';
|
|
9
3
|
import {
|
|
10
4
|
getPromiseState,
|
|
11
5
|
PromiseWrapper,
|
|
12
6
|
readPromise,
|
|
13
7
|
} from '../core/PromiseWrapper';
|
|
8
|
+
import {
|
|
9
|
+
getNetworkRequestOptionsWithDefaults,
|
|
10
|
+
NetworkRequestReaderOptions,
|
|
11
|
+
} from '../core/read';
|
|
12
|
+
import { useIsographEnvironment } from '../react/IsographEnvironmentProvider';
|
|
13
|
+
import { useReadAndSubscribe } from './useReadAndSubscribe';
|
|
14
14
|
|
|
15
15
|
export function useResult<
|
|
16
16
|
TReadFromStore extends { parameters: object; data: object },
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import { describe,
|
|
2
|
-
import {
|
|
3
|
-
ROOT_ID,
|
|
4
|
-
createIsographEnvironment,
|
|
5
|
-
type IsographStore,
|
|
6
|
-
} from '../core/IsographEnvironment';
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
7
2
|
import {
|
|
8
3
|
garbageCollectEnvironment,
|
|
9
4
|
retainQuery,
|
|
10
5
|
} from '../core/garbageCollection';
|
|
6
|
+
import {
|
|
7
|
+
createIsographEnvironment,
|
|
8
|
+
ROOT_ID,
|
|
9
|
+
type IsographStore,
|
|
10
|
+
} from '../core/IsographEnvironment';
|
|
11
11
|
import { iso } from './__isograph/iso';
|
|
12
|
+
import { meNameSuccessorRetainedQuery } from './meNameSuccessor';
|
|
12
13
|
import { nodeFieldRetainedQuery } from './nodeQuery';
|
|
13
14
|
|
|
14
15
|
const getDefaultStore = (): IsographStore => ({
|
|
@@ -52,7 +53,7 @@ export const meNameField = iso(`
|
|
|
52
53
|
}
|
|
53
54
|
}
|
|
54
55
|
`)(() => {});
|
|
55
|
-
|
|
56
|
+
|
|
56
57
|
const meNameEntrypoint = iso(`entrypoint Query.meName`);
|
|
57
58
|
const meNameRetainedQuery = {
|
|
58
59
|
normalizationAst:
|