@jigs.design/client 0.3.1 → 0.3.2
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/dist/view/controller.d.ts +3 -1
- package/dist/view/controller.js +14 -3
- package/package.json +3 -3
|
@@ -94,7 +94,9 @@ export interface ViewController {
|
|
|
94
94
|
/**
|
|
95
95
|
* Replaces the provided data, by slot name. Every read of a slot whose
|
|
96
96
|
* value changed, compared as JSON, gets the new value, as a refetched
|
|
97
|
-
* query's does; a slot left out reads as `UNAVAILABLE`.
|
|
97
|
+
* query's does; a slot left out reads as `UNAVAILABLE`. A value that is
|
|
98
|
+
* the same object as before is not compared again, so a page that keeps
|
|
99
|
+
* its values' identity pays nothing for an unchanged slot.
|
|
98
100
|
*/
|
|
99
101
|
setData: (values: Readonly<Record<string, JsonValue>> | undefined) => void;
|
|
100
102
|
/** Replaces what each new issue is given to; `undefined` stops reporting. */
|
package/dist/view/controller.js
CHANGED
|
@@ -516,16 +516,27 @@ function createViewController(client) {
|
|
|
516
516
|
},
|
|
517
517
|
setData: (values) => {
|
|
518
518
|
const next = /* @__PURE__ */ new Map();
|
|
519
|
+
const changed = /* @__PURE__ */ new Set();
|
|
519
520
|
for (const [name, value] of Object.entries(values ?? {})) {
|
|
520
|
-
const text = JSON.stringify(value);
|
|
521
521
|
const before = provided.get(name);
|
|
522
|
-
|
|
522
|
+
if (before !== void 0 && Object.is(before.value, value)) {
|
|
523
|
+
next.set(name, before);
|
|
524
|
+
continue;
|
|
525
|
+
}
|
|
526
|
+
const text = JSON.stringify(value);
|
|
527
|
+
if (before?.text === text) {
|
|
528
|
+
next.set(name, before);
|
|
529
|
+
continue;
|
|
530
|
+
}
|
|
531
|
+
next.set(name, {
|
|
523
532
|
text,
|
|
524
533
|
value
|
|
525
534
|
});
|
|
535
|
+
changed.add(name);
|
|
526
536
|
}
|
|
537
|
+
for (const name of provided.keys()) if (!next.has(name)) changed.add(name);
|
|
527
538
|
provided = next;
|
|
528
|
-
for (const [key, name] of slotReads) sendQuery(key, slotResult(name));
|
|
539
|
+
for (const [key, name] of slotReads) if (changed.has(name)) sendQuery(key, slotResult(name));
|
|
529
540
|
},
|
|
530
541
|
setIssueHandler: (handler) => {
|
|
531
542
|
issueHandler = handler;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jigs.design/client",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "createJigsClient: the browser's transport and query cache. No React.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@tanstack/query-core": "5.104.4",
|
|
29
|
-
"@jigs.design/runtime": "0.3.
|
|
30
|
-
"@jigs.design/protocol": "0.3.
|
|
29
|
+
"@jigs.design/runtime": "0.3.2",
|
|
30
|
+
"@jigs.design/protocol": "0.3.2"
|
|
31
31
|
}
|
|
32
32
|
}
|