@isograph/react 0.0.0-main-efec0f3a → 0.0.0-main-20cbb1c3
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,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-20cbb1c3 compile-libs /home/runner/work/isograph/isograph/libs/isograph-react
|
|
4
4
|
> rimraf dist && tsc -p tsconfig.pkg.json
|
|
5
5
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type NormalizationAst } from './entrypoint';
|
|
2
|
-
import { IsographEnvironment, type
|
|
2
|
+
import { IsographEnvironment, type StoreLink } from './IsographEnvironment';
|
|
3
|
+
import type { BaseStoreLayer } from './optimisticProxy';
|
|
3
4
|
import { type PromiseWrapper, type PromiseWrapperOk } from './PromiseWrapper';
|
|
4
5
|
export type RetainedQuery = {
|
|
5
6
|
readonly normalizationAst: PromiseWrapper<NormalizationAst>;
|
|
@@ -13,5 +14,5 @@ export type DidUnretainSomeQuery = boolean;
|
|
|
13
14
|
export declare function unretainQuery(environment: IsographEnvironment, retainedQuery: RetainedQuery): DidUnretainSomeQuery;
|
|
14
15
|
export declare function retainQuery(environment: IsographEnvironment, queryToRetain: RetainedQuery): void;
|
|
15
16
|
export declare function garbageCollectEnvironment(environment: IsographEnvironment): void;
|
|
16
|
-
export declare function
|
|
17
|
+
export declare function garbageCollectBaseStoreLayer(retainedQueries: RetainedQueryWithNormalizationAst[], baseStoreLayer: BaseStoreLayer): void;
|
|
17
18
|
//# sourceMappingURL=garbageCollection.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"garbageCollection.d.ts","sourceRoot":"","sources":["../../src/core/garbageCollection.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE5E,OAAO,EAGL,mBAAmB,
|
|
1
|
+
{"version":3,"file":"garbageCollection.d.ts","sourceRoot":"","sources":["../../src/core/garbageCollection.ts"],"names":[],"mappings":"AACA,OAAO,EAAyB,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAE5E,OAAO,EAGL,mBAAmB,EAGnB,KAAK,SAAS,EAEf,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,MAAM,aAAa,GAAG;IAC1B,QAAQ,CAAC,gBAAgB,EAAE,cAAc,CAAC,gBAAgB,CAAC,CAAC;IAC5D,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC;IACvB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;CAC1B,CAAC;AAEF,MAAM,WAAW,iCAAkC,SAAQ,aAAa;IACtE,QAAQ,CAAC,gBAAgB,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;CAC/D;AAWD,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAC3C,wBAAgB,aAAa,CAC3B,WAAW,EAAE,mBAAmB,EAChC,aAAa,EAAE,aAAa,GAC3B,oBAAoB,CAUtB;AAED,wBAAgB,WAAW,CACzB,WAAW,EAAE,mBAAmB,EAChC,aAAa,EAAE,aAAa,QAM7B;AAED,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,mBAAmB,QAqBzE;AAED,wBAAgB,4BAA4B,CAC1C,eAAe,EAAE,iCAAiC,EAAE,EACpD,cAAc,EAAE,cAAc,QA6B/B"}
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.unretainQuery = unretainQuery;
|
|
4
4
|
exports.retainQuery = retainQuery;
|
|
5
5
|
exports.garbageCollectEnvironment = garbageCollectEnvironment;
|
|
6
|
-
exports.
|
|
6
|
+
exports.garbageCollectBaseStoreLayer = garbageCollectBaseStoreLayer;
|
|
7
7
|
const cache_1 = require("./cache");
|
|
8
8
|
const IsographEnvironment_1 = require("./IsographEnvironment");
|
|
9
9
|
const PromiseWrapper_1 = require("./PromiseWrapper");
|
|
@@ -27,6 +27,9 @@ function retainQuery(environment, queryToRetain) {
|
|
|
27
27
|
// id + variables
|
|
28
28
|
}
|
|
29
29
|
function garbageCollectEnvironment(environment) {
|
|
30
|
+
if (environment.store.kind !== 'BaseStoreLayer') {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
30
33
|
const retainedQueries = [];
|
|
31
34
|
for (const query of environment.retainedQueries) {
|
|
32
35
|
if (!isRetainedQueryWithNormalizationAst(query)) {
|
|
@@ -40,25 +43,21 @@ function garbageCollectEnvironment(environment) {
|
|
|
40
43
|
}
|
|
41
44
|
retainedQueries.push(query);
|
|
42
45
|
}
|
|
43
|
-
|
|
44
|
-
while (node !== null) {
|
|
45
|
-
garbageCollectLayer(retainedQueries, node.data);
|
|
46
|
-
node = node.parentStoreLayer;
|
|
47
|
-
}
|
|
46
|
+
garbageCollectBaseStoreLayer(retainedQueries, environment.store);
|
|
48
47
|
}
|
|
49
|
-
function
|
|
48
|
+
function garbageCollectBaseStoreLayer(retainedQueries, baseStoreLayer) {
|
|
50
49
|
const retainedIds = {};
|
|
51
50
|
for (const query of retainedQueries) {
|
|
52
|
-
recordReachableIds(
|
|
51
|
+
recordReachableIds(baseStoreLayer.data, query, retainedIds);
|
|
53
52
|
}
|
|
54
|
-
for (const typeName in
|
|
55
|
-
const dataById =
|
|
53
|
+
for (const typeName in baseStoreLayer.data) {
|
|
54
|
+
const dataById = baseStoreLayer.data[typeName];
|
|
56
55
|
if (dataById == null)
|
|
57
56
|
continue;
|
|
58
57
|
const retainedTypeIds = retainedIds[typeName];
|
|
59
58
|
// delete all objects
|
|
60
59
|
if (retainedTypeIds == undefined || retainedTypeIds.size == 0) {
|
|
61
|
-
delete
|
|
60
|
+
delete baseStoreLayer.data[typeName];
|
|
62
61
|
continue;
|
|
63
62
|
}
|
|
64
63
|
for (const dataId in dataById) {
|
|
@@ -67,7 +66,7 @@ function garbageCollectLayer(retainedQueries, dataLayer) {
|
|
|
67
66
|
}
|
|
68
67
|
}
|
|
69
68
|
if (Object.keys(dataById).length === 0) {
|
|
70
|
-
delete
|
|
69
|
+
delete baseStoreLayer.data[typeName];
|
|
71
70
|
}
|
|
72
71
|
}
|
|
73
72
|
}
|
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-20cbb1c3",
|
|
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/
|
|
13
|
-
"@isograph/
|
|
11
|
+
"@isograph/reference-counted-pointer": "0.0.0-main-20cbb1c3",
|
|
12
|
+
"@isograph/disposable-types": "0.0.0-main-20cbb1c3",
|
|
13
|
+
"@isograph/react-disposable-state": "0.0.0-main-20cbb1c3"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"react": "^18.0.0 || ^19.0.0"
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
type StoreLink,
|
|
11
11
|
type TypeName,
|
|
12
12
|
} from './IsographEnvironment';
|
|
13
|
-
import type {
|
|
13
|
+
import type { BaseStoreLayer } from './optimisticProxy';
|
|
14
14
|
import {
|
|
15
15
|
NOT_SET,
|
|
16
16
|
type PromiseWrapper,
|
|
@@ -63,6 +63,10 @@ export function retainQuery(
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
export function garbageCollectEnvironment(environment: IsographEnvironment) {
|
|
66
|
+
if (environment.store.kind !== 'BaseStoreLayer') {
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
66
70
|
const retainedQueries: RetainedQueryWithNormalizationAst[] = [];
|
|
67
71
|
for (const query of environment.retainedQueries) {
|
|
68
72
|
if (!isRetainedQueryWithNormalizationAst(query)) {
|
|
@@ -78,31 +82,27 @@ export function garbageCollectEnvironment(environment: IsographEnvironment) {
|
|
|
78
82
|
retainedQueries.push(query);
|
|
79
83
|
}
|
|
80
84
|
|
|
81
|
-
|
|
82
|
-
while (node !== null) {
|
|
83
|
-
garbageCollectLayer(retainedQueries, node.data);
|
|
84
|
-
node = node.parentStoreLayer;
|
|
85
|
-
}
|
|
85
|
+
garbageCollectBaseStoreLayer(retainedQueries, environment.store);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
export function
|
|
88
|
+
export function garbageCollectBaseStoreLayer(
|
|
89
89
|
retainedQueries: RetainedQueryWithNormalizationAst[],
|
|
90
|
-
|
|
90
|
+
baseStoreLayer: BaseStoreLayer,
|
|
91
91
|
) {
|
|
92
92
|
const retainedIds: RetainedIds = {};
|
|
93
93
|
|
|
94
94
|
for (const query of retainedQueries) {
|
|
95
|
-
recordReachableIds(
|
|
95
|
+
recordReachableIds(baseStoreLayer.data, query, retainedIds);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
for (const typeName in
|
|
99
|
-
const dataById =
|
|
98
|
+
for (const typeName in baseStoreLayer.data) {
|
|
99
|
+
const dataById = baseStoreLayer.data[typeName];
|
|
100
100
|
if (dataById == null) continue;
|
|
101
101
|
const retainedTypeIds = retainedIds[typeName];
|
|
102
102
|
|
|
103
103
|
// delete all objects
|
|
104
104
|
if (retainedTypeIds == undefined || retainedTypeIds.size == 0) {
|
|
105
|
-
delete
|
|
105
|
+
delete baseStoreLayer.data[typeName];
|
|
106
106
|
continue;
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -113,7 +113,7 @@ export function garbageCollectLayer(
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
if (Object.keys(dataById).length === 0) {
|
|
116
|
-
delete
|
|
116
|
+
delete baseStoreLayer.data[typeName];
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
}
|