@instantdb/core 0.22.87-experimental.drewh-docs-header.20182682555.1 → 0.22.87-experimental.drewh-entity-caching.20182780212.1
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/__tests__/src/instaql.bench.js +80 -2
- package/__tests__/src/instaqlCache.test.ts +78 -0
- package/dist/commonjs/store.d.ts +1 -1
- package/dist/commonjs/store.d.ts.map +1 -1
- package/dist/commonjs/store.js +5 -0
- package/dist/commonjs/store.js.map +1 -1
- package/dist/esm/store.d.ts +1 -1
- package/dist/esm/store.d.ts.map +1 -1
- package/dist/esm/store.js +5 -0
- package/dist/esm/store.js.map +1 -1
- package/dist/standalone/index.js +708 -705
- package/dist/standalone/index.umd.cjs +3 -3
- package/package.json +2 -2
- package/src/store.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instantdb/core",
|
|
3
|
-
"version": "0.22.87-experimental.drewh-
|
|
3
|
+
"version": "0.22.87-experimental.drewh-entity-caching.20182780212.1",
|
|
4
4
|
"description": "Instant's core local abstraction",
|
|
5
5
|
"homepage": "https://github.com/instantdb/instant/tree/main/client/packages/core",
|
|
6
6
|
"repository": {
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"mutative": "^1.0.10",
|
|
55
55
|
"uuid": "^11.1.0",
|
|
56
|
-
"@instantdb/version": "0.22.87-experimental.drewh-
|
|
56
|
+
"@instantdb/version": "0.22.87-experimental.drewh-entity-caching.20182780212.1"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"test": "vitest",
|
package/src/store.ts
CHANGED
|
@@ -677,11 +677,16 @@ export function getTriples(store, [e, a, v]) {
|
|
|
677
677
|
}
|
|
678
678
|
}
|
|
679
679
|
|
|
680
|
+
const cache = {};
|
|
681
|
+
|
|
680
682
|
export function getAsObject(
|
|
681
683
|
store: Store,
|
|
682
684
|
attrs: Map<string, InstantDBAttr> | undefined,
|
|
683
685
|
e: string,
|
|
684
686
|
) {
|
|
687
|
+
if (cache[e]) {
|
|
688
|
+
return cache[e];
|
|
689
|
+
}
|
|
685
690
|
const obj = {};
|
|
686
691
|
|
|
687
692
|
if (!attrs) {
|
|
@@ -695,6 +700,7 @@ export function getAsObject(
|
|
|
695
700
|
obj[label] = triple[2];
|
|
696
701
|
}
|
|
697
702
|
}
|
|
703
|
+
cache[e] = obj;
|
|
698
704
|
|
|
699
705
|
return obj;
|
|
700
706
|
}
|