@isograph/react 0.0.0-main-ea95eb02 → 0.0.0-main-21615445
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
> @isograph/react@0.0.0-main-
|
|
2
|
+
> @isograph/react@0.0.0-main-21615445 compile-typescript /Users/runner/work/isograph/isograph/libs/isograph-react
|
|
3
3
|
> rm -rf dist/* && tsc -p tsconfig.pkg.json
|
|
4
4
|
|
|
@@ -8,12 +8,12 @@ const PromiseWrapper_1 = require("./PromiseWrapper");
|
|
|
8
8
|
const startUpdate_1 = require("./startUpdate");
|
|
9
9
|
function getOrCreateCachedComponent(environment, componentName, fragmentReference, networkRequestOptions) {
|
|
10
10
|
var _a, _b, _c;
|
|
11
|
-
//
|
|
11
|
+
// cachedComponentsByLink is a three layer cache: link, then component name, then
|
|
12
12
|
// stringified args. These three, together, uniquely identify a read at a given
|
|
13
13
|
// time.
|
|
14
|
-
const
|
|
14
|
+
const cachedComponentsByLink = environment.componentCache;
|
|
15
15
|
const recordLink = fragmentReference.root.__link;
|
|
16
|
-
const componentsByName = ((_a =
|
|
16
|
+
const componentsByName = ((_a = cachedComponentsByLink[recordLink]) !== null && _a !== void 0 ? _a : (cachedComponentsByLink[recordLink] = {}));
|
|
17
17
|
const byArgs = ((_b = componentsByName[componentName]) !== null && _b !== void 0 ? _b : (componentsByName[componentName] = {}));
|
|
18
18
|
const stringifiedArgs = JSON.stringify((0, cache_1.stableCopy)(fragmentReference.variables));
|
|
19
19
|
return ((_c = byArgs[stringifiedArgs]) !== null && _c !== void 0 ? _c : (byArgs[stringifiedArgs] = (() => {
|
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-21615445",
|
|
4
4
|
"description": "Use Isograph with React",
|
|
5
5
|
"homepage": "https://isograph.dev",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -20,9 +20,9 @@
|
|
|
20
20
|
"iso-watch": "cross-env ../../target/debug/isograph_cli --config ./isograph.config.json --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@isograph/disposable-types": "0.0.0-main-
|
|
24
|
-
"@isograph/react-disposable-state": "0.0.0-main-
|
|
25
|
-
"@isograph/reference-counted-pointer": "0.0.0-main-
|
|
23
|
+
"@isograph/disposable-types": "0.0.0-main-21615445",
|
|
24
|
+
"@isograph/react-disposable-state": "0.0.0-main-21615445",
|
|
25
|
+
"@isograph/reference-counted-pointer": "0.0.0-main-21615445"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"react": "^18.0.0 || ^19.0.0"
|
|
@@ -13,14 +13,14 @@ export function getOrCreateCachedComponent(
|
|
|
13
13
|
fragmentReference: FragmentReference<any, any>,
|
|
14
14
|
networkRequestOptions: NetworkRequestReaderOptions,
|
|
15
15
|
): React.FC<any> {
|
|
16
|
-
//
|
|
16
|
+
// cachedComponentsByLink is a three layer cache: link, then component name, then
|
|
17
17
|
// stringified args. These three, together, uniquely identify a read at a given
|
|
18
18
|
// time.
|
|
19
|
-
const
|
|
19
|
+
const cachedComponentsByLink = environment.componentCache;
|
|
20
20
|
|
|
21
21
|
const recordLink = fragmentReference.root.__link;
|
|
22
22
|
|
|
23
|
-
const componentsByName = (
|
|
23
|
+
const componentsByName = (cachedComponentsByLink[recordLink] ??= {});
|
|
24
24
|
|
|
25
25
|
const byArgs = (componentsByName[componentName] ??= {});
|
|
26
26
|
|