snapback4 0.0.11 → 0.0.13
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/client.js +7 -0
- package/dist/local.js +8 -0
- package/dist/replica/interpreter.d.ts +2 -0
- package/dist/replica/interpreter.js +11 -0
- package/package.json +2 -2
package/dist/client.js
CHANGED
|
@@ -213,6 +213,13 @@ export function createClient(options) {
|
|
|
213
213
|
subscribe(notifyMe) {
|
|
214
214
|
mine.add(notifyMe);
|
|
215
215
|
own.subscribers.add(notifyMe);
|
|
216
|
+
// A screen that closed this key a moment ago (React unmounts the
|
|
217
|
+
// old component before the new one subscribes) may have removed
|
|
218
|
+
// the watch: put it back, and refresh it.
|
|
219
|
+
if (watches.get(own.key) !== own) {
|
|
220
|
+
watches.set(own.key, own);
|
|
221
|
+
void refresh(own);
|
|
222
|
+
}
|
|
216
223
|
return () => {
|
|
217
224
|
mine.delete(notifyMe);
|
|
218
225
|
own.subscribers.delete(notifyMe);
|
package/dist/local.js
CHANGED
|
@@ -284,6 +284,14 @@ export async function createLocalClient(options) {
|
|
|
284
284
|
subscribe(listener) {
|
|
285
285
|
mine.add(listener);
|
|
286
286
|
own.subscribers.add(listener);
|
|
287
|
+
// A screen that closed this key a moment ago (React unmounts the
|
|
288
|
+
// old component before the new one subscribes) may have removed
|
|
289
|
+
// the watch: put it back, and refresh it, so no subscriber is
|
|
290
|
+
// left on a watch nothing updates.
|
|
291
|
+
if (watches.get(own.key) !== own) {
|
|
292
|
+
watches.set(own.key, own);
|
|
293
|
+
void rerun(own);
|
|
294
|
+
}
|
|
287
295
|
return () => { mine.delete(listener); own.subscribers.delete(listener); };
|
|
288
296
|
},
|
|
289
297
|
close() {
|
|
@@ -60,6 +60,8 @@ export declare class Interpreter {
|
|
|
60
60
|
private beyondHorizon;
|
|
61
61
|
/** The program's page had more rows and no cursor to continue on. */
|
|
62
62
|
private pageOverflow;
|
|
63
|
+
/** A field of a pending row was read while building an object. */
|
|
64
|
+
private pendingTouched;
|
|
63
65
|
private page;
|
|
64
66
|
private pageDepth;
|
|
65
67
|
private created;
|
|
@@ -137,6 +137,8 @@ export class Interpreter {
|
|
|
137
137
|
beyondHorizon = false;
|
|
138
138
|
/** The program's page had more rows and no cursor to continue on. */
|
|
139
139
|
pageOverflow = false;
|
|
140
|
+
/** A field of a pending row was read while building an object. */
|
|
141
|
+
pendingTouched = false;
|
|
140
142
|
page = null;
|
|
141
143
|
pageDepth = 0;
|
|
142
144
|
created = new Set();
|
|
@@ -361,6 +363,8 @@ export class Interpreter {
|
|
|
361
363
|
return null;
|
|
362
364
|
if (typeof base !== "object")
|
|
363
365
|
throw new Refused({ code: "E_FIELD", family: "input", message: `no field ${b.name}` });
|
|
366
|
+
if (base.pending === true)
|
|
367
|
+
this.pendingTouched = true;
|
|
364
368
|
return base[b.name] ?? null;
|
|
365
369
|
}
|
|
366
370
|
case "Array": {
|
|
@@ -370,9 +374,16 @@ export class Interpreter {
|
|
|
370
374
|
return out;
|
|
371
375
|
}
|
|
372
376
|
case "Object": {
|
|
377
|
+
// A shape over a pending row is pending: the card's word survives
|
|
378
|
+
// the field selection, so a screen shows "Sending…" on shaped rows too.
|
|
379
|
+
const outer = this.pendingTouched;
|
|
380
|
+
this.pendingTouched = false;
|
|
373
381
|
const out = {};
|
|
374
382
|
for (const [k, v] of Object.entries(body))
|
|
375
383
|
out[k] = await this.expr(v);
|
|
384
|
+
if (this.pendingTouched && !("pending" in out))
|
|
385
|
+
out.pending = true;
|
|
386
|
+
this.pendingTouched = outer || this.pendingTouched;
|
|
376
387
|
return out;
|
|
377
388
|
}
|
|
378
389
|
case "Binary": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snapback4",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Snapback 4: the card (contract), the online and local-first clients (IndexedDB, SQLite), React hooks, sign-in, a labelled mock, and the `snapback4` CLI. LLP 3000.",
|
|
6
6
|
"bin": {
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"README.md"
|
|
43
43
|
],
|
|
44
44
|
"optionalDependencies": {
|
|
45
|
-
"snapback4-darwin-arm64": "0.0.
|
|
45
|
+
"snapback4-darwin-arm64": "0.0.13"
|
|
46
46
|
},
|
|
47
47
|
"scripts": {
|
|
48
48
|
"build": "tsc -p tsconfig.build.json",
|