@xmachines/play-dom 2.1.1 → 3.0.0
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/README.md +80 -14
- package/dist/PlayRenderer.d.ts +98 -0
- package/dist/PlayRenderer.d.ts.map +1 -1
- package/dist/PlayRenderer.js +317 -19
- package/dist/PlayRenderer.js.map +1 -1
- package/dist/create-play-ui.d.ts +37 -7
- package/dist/create-play-ui.d.ts.map +1 -1
- package/dist/create-play-ui.js +30 -14
- package/dist/create-play-ui.js.map +1 -1
- package/dist/create-renderer.d.ts +2 -1
- package/dist/create-renderer.d.ts.map +1 -1
- package/dist/create-renderer.js +2 -1
- package/dist/create-renderer.js.map +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -2
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +102 -10
- package/dist/types.d.ts.map +1 -1
- package/package.json +10 -10
package/dist/PlayRenderer.js
CHANGED
|
@@ -13,8 +13,58 @@
|
|
|
13
13
|
import { watchSignal } from "@xmachines/play-signals";
|
|
14
14
|
import { createAtom } from "@xstate/store";
|
|
15
15
|
import { xstateStoreStateStore } from "@xmachines/json-render-xstate";
|
|
16
|
-
import { createViewStoreLifecycle, refreshContextSubtree } from "@xmachines/play-actor";
|
|
16
|
+
import { createReportGuard, createViewStoreLifecycle, refreshContextSubtree, } from "@xmachines/play-actor";
|
|
17
17
|
import { createIncrementalRenderer } from "@xmachines/json-render-dom";
|
|
18
|
+
/**
|
|
19
|
+
* What the report guard writes, and what it lets through.
|
|
20
|
+
*
|
|
21
|
+
* It CONTAINS a handler of the host that throws, exactly as the four framework renderers
|
|
22
|
+
* do. The five hold one rule, and a caller learns it one time: a handler of the host never
|
|
23
|
+
* defeats the containment. A host that must escalate raises the failure from a task of its
|
|
24
|
+
* own, which reaches the global handler of the page in every one of the five.
|
|
25
|
+
*
|
|
26
|
+
* It stands ABOVE the doc comment of the class, and so does every other declaration of
|
|
27
|
+
* this module: a declaration takes the comment block that stands directly before it, so a
|
|
28
|
+
* const or a function placed between that comment and the class takes the documentation
|
|
29
|
+
* of `PlayRenderer` with it, and the class reaches the generated reference with none.
|
|
30
|
+
*/
|
|
31
|
+
const GUARD_MESSAGES = {
|
|
32
|
+
noHandler: "[@xmachines/play-dom] PlayRenderer contained a failed rebuild of the view. " +
|
|
33
|
+
"Give an onError option to receive it.",
|
|
34
|
+
handlerThrew: "[@xmachines/play-dom] the onError handler of the host threw. " +
|
|
35
|
+
"PlayRenderer contained the failure of the view all the same.",
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Runs one release of a caller, and it contains a failure of that release.
|
|
39
|
+
*
|
|
40
|
+
* Every release that the two teardown paths below run is CODE OF A CALLER: the
|
|
41
|
+
* `unsubscribe` of a store that the host gave, and the watch cleanups that the inner
|
|
42
|
+
* renderer registered. Each one can throw, and a throw must stop neither path.
|
|
43
|
+
*
|
|
44
|
+
* `resetFailedRebuild()` runs the releases of a FAILED rebuild, BEFORE the renderer
|
|
45
|
+
* contains the failure of the view. A throw there takes the containment down with it: the
|
|
46
|
+
* catch that called it reaches `contain()` never, so the failure of the view reaches no
|
|
47
|
+
* handler, the dead tree stays on the screen, and the failure of the release escapes in
|
|
48
|
+
* its place — which is both outcomes that the containment exists to prevent.
|
|
49
|
+
*
|
|
50
|
+
* `disconnect()` has no containment to defeat, and it has the same rule for a second
|
|
51
|
+
* reason: a throw from the first release skips every release after it, it skips the clear
|
|
52
|
+
* of the container, and it skips the reset of the identity. The renderer then holds a
|
|
53
|
+
* half teardown that no caller can complete.
|
|
54
|
+
*
|
|
55
|
+
* Each release therefore stands alone, and a failure of one goes to `console.error`.
|
|
56
|
+
*/
|
|
57
|
+
function releaseQuietly(release) {
|
|
58
|
+
if (!release)
|
|
59
|
+
return;
|
|
60
|
+
try {
|
|
61
|
+
release();
|
|
62
|
+
}
|
|
63
|
+
catch (releaseFailure) {
|
|
64
|
+
console.error("[@xmachines/play-dom] a release of PlayRenderer threw. " +
|
|
65
|
+
"The renderer completed the teardown all the same.", releaseFailure);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
18
68
|
/**
|
|
19
69
|
* PlayRenderer connects the `currentView` signal of an actor to the DOM renderer.
|
|
20
70
|
*
|
|
@@ -65,6 +115,15 @@ export class PlayRenderer {
|
|
|
65
115
|
actor;
|
|
66
116
|
registry;
|
|
67
117
|
options;
|
|
118
|
+
/**
|
|
119
|
+
* True from the start of `connect()` to the end of `disconnect()`.
|
|
120
|
+
*
|
|
121
|
+
* The watcher cannot answer this question. `connect()` installs it AFTER the
|
|
122
|
+
* synchronous first render, so a host that calls `connect()` again from the `onError`
|
|
123
|
+
* of that render finds no watcher, and a test of the watcher alone would skip the
|
|
124
|
+
* `disconnect()` and leave the guard of the abandoned connection alive for ever.
|
|
125
|
+
*/
|
|
126
|
+
connected = false;
|
|
68
127
|
unwatch = null;
|
|
69
128
|
storeUnsubscribe = null;
|
|
70
129
|
/**
|
|
@@ -89,6 +148,8 @@ export class PlayRenderer {
|
|
|
89
148
|
*/
|
|
90
149
|
lastViewKey = undefined;
|
|
91
150
|
currentStore = null;
|
|
151
|
+
/** The fallback element, built at the first moment that the renderer shows it. */
|
|
152
|
+
fallbackElement = null;
|
|
92
153
|
/**
|
|
93
154
|
* The shared coordinator of the store lifecycle, from @xmachines/play-actor. It
|
|
94
155
|
* seeds the store again on a change of the viewKey, it refreshes /context in place
|
|
@@ -105,6 +166,27 @@ export class PlayRenderer {
|
|
|
105
166
|
* call, which is rare but correct, changes no detached DOM tree.
|
|
106
167
|
*/
|
|
107
168
|
alive = true;
|
|
169
|
+
/**
|
|
170
|
+
* The report guard, from @xmachines/play-actor.
|
|
171
|
+
*
|
|
172
|
+
* It blocks a reset that the host calls from INSIDE the report, and every reset once
|
|
173
|
+
* the renderer is disconnected. The five renderers share the one implementation.
|
|
174
|
+
*
|
|
175
|
+
* `alive` cannot answer the second half. A contained failure sets that flag to `false`
|
|
176
|
+
* and the next emission sets it back, because it guards the callback of the store
|
|
177
|
+
* subscription — a reset that a host keeps outlives both.
|
|
178
|
+
*/
|
|
179
|
+
// It is NOT readonly: `disconnect()` disposes the guard, and `connect()` revives the
|
|
180
|
+
// renderer, so a reconnected renderer needs a guard that is not spent.
|
|
181
|
+
guard = createReportGuard(GUARD_MESSAGES);
|
|
182
|
+
/**
|
|
183
|
+
* The retry that every report of THIS connection hands the host.
|
|
184
|
+
*
|
|
185
|
+
* `connect()` builds one, beside the guard that it belongs to. The four framework
|
|
186
|
+
* renderers hand the host one reset for the life of the provider, and this field holds
|
|
187
|
+
* the same rule for the life of the connection.
|
|
188
|
+
*/
|
|
189
|
+
retry = this.retryOf(this.guard);
|
|
108
190
|
/**
|
|
109
191
|
* @param container - The `HTMLElement` to render into. Each view transition clears it and fills it again.
|
|
110
192
|
* @param actor - The actor with the `currentView` signal. It must implement `Viewable`.
|
|
@@ -118,6 +200,8 @@ export class PlayRenderer {
|
|
|
118
200
|
* - `validationFunctions` — your own check functions. They are available at `ctx.ctx.validationFunctions`.
|
|
119
201
|
* - `navigate` — the navigation callback. The renderer calls it for `onSuccess: { navigate: "..." }`.
|
|
120
202
|
* - `onRenderError` — the `(error, name)` handler of a component render error and of an action handler rejection. It stops the `console.error` fallback.
|
|
203
|
+
* - `onError` — the `(error, reset)` handler of a failure of a complete rebuild. The renderer contains such a failure always, and this option says where the report goes.
|
|
204
|
+
* - `fallback` — the element to show for every null view, and after a contained failure.
|
|
121
205
|
*/
|
|
122
206
|
constructor(container, actor, registry, options = {}) {
|
|
123
207
|
this.container = container;
|
|
@@ -135,16 +219,55 @@ export class PlayRenderer {
|
|
|
135
219
|
* renderer first.
|
|
136
220
|
*/
|
|
137
221
|
connect() {
|
|
138
|
-
if (this.
|
|
222
|
+
if (this.connected)
|
|
139
223
|
this.disconnect();
|
|
140
|
-
this.
|
|
141
|
-
|
|
224
|
+
this.connected = true;
|
|
225
|
+
const guard = createReportGuard(GUARD_MESSAGES);
|
|
226
|
+
this.guard = guard;
|
|
227
|
+
// ONE retry for the connection, as the four framework renderers hand the host one
|
|
228
|
+
// reset for the life of the provider. A retry built for each report gives a host
|
|
229
|
+
// that keys a Map on the callback one entry for each failure.
|
|
230
|
+
this.retry = this.retryOf(guard);
|
|
231
|
+
// The first render is SYNCHRONOUS, and it can reach `onError`. It needs no `try`: the
|
|
232
|
+
// renderer contains a failed rebuild, and the guard contains a handler of the host
|
|
233
|
+
// that throws, so this call returns for every view that a caller can give.
|
|
234
|
+
const seeded = this.actor.currentView.get();
|
|
235
|
+
this.render(seeded);
|
|
236
|
+
// A host that tears the renderer down from the handler — a fatal view, and the host
|
|
237
|
+
// gives up — calls `disconnect()` while this method still runs, and the line below
|
|
238
|
+
// would then hand the renderer a live watcher again: it renders into a container
|
|
239
|
+
// that the host released, and the watcher outlives the actor.
|
|
240
|
+
//
|
|
241
|
+
// A host that CONNECTS again from the handler reaches the same line. The `connected`
|
|
242
|
+
// flag above makes that call disconnect this connection first, so both hosts dispose
|
|
243
|
+
// the guard of THIS call. Ask that guard, and not the field: the field holds the
|
|
244
|
+
// guard of the connection that took the place of this one.
|
|
245
|
+
if (guard.blocked())
|
|
246
|
+
return;
|
|
247
|
+
this.unwatch = watchSignal(this.actor.currentView, (view) => {
|
|
248
|
+
this.render(view);
|
|
249
|
+
});
|
|
250
|
+
// The actor can hold ANOTHER view already. The render above is synchronous, and a
|
|
251
|
+
// host that REPAIRS the actor from the handler — a bad initial view, and the host
|
|
252
|
+
// sends a recovery event — moves the signal between the read and the line above.
|
|
253
|
+
// `watchSignal` seeds nothing, so the repaired view would wait for the next
|
|
254
|
+
// emission of the actor, and a screen that shows the fallback of a failure that the
|
|
255
|
+
// host repaired already would wait with it. Render the view that the actor holds
|
|
256
|
+
// NOW.
|
|
257
|
+
//
|
|
258
|
+
// This runs one time, and it loops for no host: a repair from THIS render reaches
|
|
259
|
+
// the watcher above, which is installed already.
|
|
260
|
+
const current = this.actor.currentView.get();
|
|
261
|
+
if (current !== seeded)
|
|
262
|
+
this.render(current);
|
|
142
263
|
}
|
|
143
264
|
/**
|
|
144
265
|
* Stops the watch and clears the container.
|
|
145
266
|
*/
|
|
146
267
|
disconnect() {
|
|
147
|
-
this.
|
|
268
|
+
this.connected = false;
|
|
269
|
+
this.guard.dispose();
|
|
270
|
+
releaseQuietly(this.unwatch);
|
|
148
271
|
this.unwatch = null;
|
|
149
272
|
// Set the refs to null first. A rerender callback that is still in flight therefore
|
|
150
273
|
// sees null, and it stops.
|
|
@@ -159,9 +282,10 @@ export class PlayRenderer {
|
|
|
159
282
|
// Set alive = false before the storeUnsub() call. A synchronous rerender callback
|
|
160
283
|
// from inside unsubscribe() therefore returns at once.
|
|
161
284
|
this.alive = false;
|
|
162
|
-
|
|
285
|
+
// See releaseQuietly: a throw of one release must skip none of the work below it.
|
|
286
|
+
releaseQuietly(storeUnsub);
|
|
163
287
|
for (const cleanup of watchCleanups)
|
|
164
|
-
cleanup
|
|
288
|
+
releaseQuietly(cleanup);
|
|
165
289
|
this.container.replaceChildren();
|
|
166
290
|
// The rule of the lifetime: the store that stays alive dies with the connection.
|
|
167
291
|
this.lastViewKey = undefined;
|
|
@@ -195,7 +319,16 @@ export class PlayRenderer {
|
|
|
195
319
|
this.lastViewKey === view.viewKey &&
|
|
196
320
|
this.currentStore !== null &&
|
|
197
321
|
this.storeUnsubscribe !== null) {
|
|
198
|
-
|
|
322
|
+
// The fast path reads `spec.state` too, so it fails exactly as a rebuild does.
|
|
323
|
+
// It sat OUTSIDE the try below, so a stream that keeps its viewKey and emits a
|
|
324
|
+
// spec with an accessor that throws escaped the callback of watchSignal
|
|
325
|
+
// uncontained, with the stale tree still on the screen.
|
|
326
|
+
try {
|
|
327
|
+
refreshContextSubtree(this.currentStore, view);
|
|
328
|
+
}
|
|
329
|
+
catch (error) {
|
|
330
|
+
this.failView(error);
|
|
331
|
+
}
|
|
199
332
|
return;
|
|
200
333
|
}
|
|
201
334
|
this.alive = true;
|
|
@@ -204,9 +337,13 @@ export class PlayRenderer {
|
|
|
204
337
|
// callback sees a live storeUnsubscribe, and it enters the rerender path again with
|
|
205
338
|
// an old view and an old store.
|
|
206
339
|
// disconnect() uses the same capture-then-clear pattern.
|
|
340
|
+
// See releaseQuietly. This release is code of a caller, and it runs on the path of a
|
|
341
|
+
// view that WORKS: a throw here would abort the render of a good view, and it would
|
|
342
|
+
// leave the renderer with the tree of the previous view on the screen and half of
|
|
343
|
+
// its registrations released.
|
|
207
344
|
const oldUnsub = this.storeUnsubscribe;
|
|
208
345
|
this.storeUnsubscribe = null;
|
|
209
|
-
oldUnsub
|
|
346
|
+
releaseQuietly(oldUnsub);
|
|
210
347
|
// Release the watch cleanups of the first render of the previous view.
|
|
211
348
|
// Without this step, the watch subscriptions of the previous view stay active between
|
|
212
349
|
// a view transition and the first store update of the new view. They then hold a
|
|
@@ -215,13 +352,18 @@ export class PlayRenderer {
|
|
|
215
352
|
const prevWatchCleanups = [...this.watchCleanups];
|
|
216
353
|
this.watchCleanups = new Set();
|
|
217
354
|
for (const cleanup of prevWatchCleanups)
|
|
218
|
-
cleanup
|
|
355
|
+
releaseQuietly(cleanup);
|
|
219
356
|
this.container.replaceChildren();
|
|
220
357
|
// A null emission is a gap between two views, and not a new view: keep lastViewKey
|
|
221
358
|
// and currentStore. A return to the same identity therefore uses the store below
|
|
222
359
|
// again. disconnect() stays the boundary of the lifetime.
|
|
223
|
-
if (!view)
|
|
360
|
+
if (!view) {
|
|
361
|
+
// Show the fallback for EVERY null view, and not for the first mount only. The
|
|
362
|
+
// four framework providers hold the same rule: a null currentView renders the
|
|
363
|
+
// placeholder content of the provider, at any moment of the life of the tree.
|
|
364
|
+
this.showFallback();
|
|
224
365
|
return;
|
|
366
|
+
}
|
|
225
367
|
// Resolve the store through the shared lifecycle. There are three results: the
|
|
226
368
|
// external store, which is the controlled mode, and the coordinator refreshes its
|
|
227
369
|
// /context, because the machinery owns /context in both modes; the store that the
|
|
@@ -230,16 +372,134 @@ export class PlayRenderer {
|
|
|
230
372
|
// is gone, and the coordinator refreshes /context in place, because the context can
|
|
231
373
|
// move during the gap); or a new store of this view, with the values of the composed
|
|
232
374
|
// state.
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
//
|
|
236
|
-
|
|
375
|
+
// The resolution stands INSIDE the try. It reads `spec.state`, and a spec can fail
|
|
376
|
+
// there — the accessor of a projection throws, or a seed of the store does. Such a
|
|
377
|
+
// failure aborts the rebuild exactly as a failure of renderView does, so the
|
|
378
|
+
// containment must cover it. The ErrorBoundary of play-solid covers the same
|
|
379
|
+
// accessor, and packages/play-solid/test/PlayRenderer-edge-error-boundary.test.tsx
|
|
380
|
+
// holds that rule.
|
|
237
381
|
try {
|
|
382
|
+
const resolution = this.storeLifecycle.resolve(this.actor, view, this.options.store);
|
|
383
|
+
this.lastViewKey = view.viewKey;
|
|
384
|
+
// The code keeps the store without a guard, for the refresh of the fast path of a slice.
|
|
385
|
+
this.currentStore = resolution.store;
|
|
238
386
|
this.renderView(view, resolution.guardedStore);
|
|
239
387
|
}
|
|
240
388
|
catch (error) {
|
|
241
|
-
|
|
242
|
-
|
|
389
|
+
// Containment: the renderer holds a failure of the complete rebuild ALWAYS. It
|
|
390
|
+
// propagates none — not out of connect() for the initial view, and not out of
|
|
391
|
+
// the callback of watchSignal for a later view. No option turns this on, and
|
|
392
|
+
// none turns it off.
|
|
393
|
+
// failView() clears the container and fills it with the fallback, exactly as on
|
|
394
|
+
// a null view. The next view that renders clears the container again, which
|
|
395
|
+
// removes the fallback.
|
|
396
|
+
this.failView(error);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* The end of a render that failed, in ONE place.
|
|
401
|
+
*
|
|
402
|
+
* Three paths render — the fast path of a slice, the complete rebuild, and the write
|
|
403
|
+
* of the store — and each one ends here. The ORDER is load-bearing: the reset takes
|
|
404
|
+
* the registrations of the dead tree down BEFORE the report, so a handler of the host
|
|
405
|
+
* that renders again meets a renderer that holds nothing of the failed attempt. A
|
|
406
|
+
* second copy of the pair is a second chance to put the two in the other order.
|
|
407
|
+
*
|
|
408
|
+
* @param error - The failure that the renderer contains.
|
|
409
|
+
*/
|
|
410
|
+
failView(error) {
|
|
411
|
+
this.resetFailedRebuild();
|
|
412
|
+
this.contain(error);
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Clears the screen of the failed view, shows the fallback, and reports the failure.
|
|
416
|
+
*
|
|
417
|
+
* The renderer contains such a failure ALWAYS. No option turns the containment on,
|
|
418
|
+
* and none turns it off: `onError` says where the report goes, and `fallback` says
|
|
419
|
+
* what the empty container shows. The four framework renderers hold the same rule,
|
|
420
|
+
* because an error boundary of a framework is not an option that a caller turns off.
|
|
421
|
+
* A host that must escalate a failure raises it from a task of its own —
|
|
422
|
+
* `queueMicrotask(() => { throw error; })` — because the guard contains a handler
|
|
423
|
+
* that throws, exactly as the four framework renderers do.
|
|
424
|
+
*
|
|
425
|
+
* The container is cleared FIRST. The fast path of a slice holds the live tree of the
|
|
426
|
+
* previous emission, and that tree is dead as soon as the refresh throws, so the
|
|
427
|
+
* renderer must not keep it on the screen. A clear container also lets the fallback
|
|
428
|
+
* stand alone.
|
|
429
|
+
*
|
|
430
|
+
* The SCREEN comes first, and the report second: a handler that throws — a reporter
|
|
431
|
+
* that fails, or one that re-raises to escalate — must not defeat the containment
|
|
432
|
+
* that it was given to observe. With the order reversed the container stays empty AND
|
|
433
|
+
* the error escapes, which is both outcomes that the containment exists to prevent.
|
|
434
|
+
*/
|
|
435
|
+
contain(error) {
|
|
436
|
+
this.container.replaceChildren();
|
|
437
|
+
this.showFallback();
|
|
438
|
+
// Without `onError` the error reaches no handler and no caller. Write it to
|
|
439
|
+
// `console.error`, in the same way as the inner renderer does for a component that
|
|
440
|
+
// throws without an `onRenderError` handler. A silent crash is the one result that
|
|
441
|
+
// no caller can debug.
|
|
442
|
+
const { onError } = this.options;
|
|
443
|
+
// The guard and the retry of THIS connection, read one time. A `connect()` that the
|
|
444
|
+
// handler starts replaces both fields, and this report belongs to the connection
|
|
445
|
+
// that reported.
|
|
446
|
+
const guard = this.guard;
|
|
447
|
+
const retry = this.retry;
|
|
448
|
+
guard.report(error, onError && (() => onError(error, retry)));
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Builds the retry that one report hands the host.
|
|
452
|
+
*
|
|
453
|
+
* The read of the signal happens at the moment of the CALL: a retry that held the view
|
|
454
|
+
* that failed would take a host off the healthy screen and back onto the one that
|
|
455
|
+
* threw.
|
|
456
|
+
*
|
|
457
|
+
* The retry belongs to the guard of ITS connection, and it asks that guard alone. A
|
|
458
|
+
* host may KEEP the callback — a "Retry" button of a toast outlives the route that
|
|
459
|
+
* opened it — and `disconnect()` disposes the guard that was live then. `connect()`
|
|
460
|
+
* disconnects a connected renderer first, so every guard that leaves the field is a
|
|
461
|
+
* disposed guard, and a retry of an older connection stays dead. The rule of the prop
|
|
462
|
+
* is one rule: a reset after `disconnect()` does nothing.
|
|
463
|
+
*
|
|
464
|
+
* @param guard - The guard of the connection that this retry belongs to.
|
|
465
|
+
*/
|
|
466
|
+
retryOf(guard) {
|
|
467
|
+
return () => {
|
|
468
|
+
if (guard.blocked())
|
|
469
|
+
return;
|
|
470
|
+
this.render(this.actor.currentView.get());
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
/**
|
|
474
|
+
* Appends the fallback element to the container, which the caller cleared already.
|
|
475
|
+
* The renderer calls it for a null view, and after a failure of a rebuild that it
|
|
476
|
+
* contains. Both callers clear the container first. `appendChild` moves the node.
|
|
477
|
+
* Therefore a second call adds no copy.
|
|
478
|
+
*/
|
|
479
|
+
showFallback() {
|
|
480
|
+
const fallback = this.options.fallback;
|
|
481
|
+
if (fallback == null)
|
|
482
|
+
return;
|
|
483
|
+
// The producer of the fallback is CODE OF THE HOST, and it can throw: a template
|
|
484
|
+
// lookup that finds nothing, a DOM API that the runtime lacks. This method runs on
|
|
485
|
+
// the null path outside every try, and inside `contain()` after the containment
|
|
486
|
+
// decided to hold an error — so a throw here escaped `connect()` and the callback
|
|
487
|
+
// of watchSignal uncontained, and it turned a contained failure into an uncontained
|
|
488
|
+
// one with the container empty.
|
|
489
|
+
//
|
|
490
|
+
// The report goes to `console.error` and NOT to `onError`: this method runs from
|
|
491
|
+
// inside `contain()`, and a second trip through the containment would report the
|
|
492
|
+
// failure of the fallback as a failure of the view.
|
|
493
|
+
try {
|
|
494
|
+
// A producer runs at the first moment that the renderer needs the element, and
|
|
495
|
+
// the memo keeps it: a later null view of THIS renderer shows the same node, and
|
|
496
|
+
// a renderer whose view is never null builds nothing at all.
|
|
497
|
+
this.fallbackElement ??= typeof fallback === "function" ? fallback() : fallback;
|
|
498
|
+
this.container.appendChild(this.fallbackElement);
|
|
499
|
+
}
|
|
500
|
+
catch (error) {
|
|
501
|
+
console.error("[@xmachines/play-dom] the fallback of PlayRenderer failed to build. " +
|
|
502
|
+
"The container stays empty.", error);
|
|
243
503
|
}
|
|
244
504
|
}
|
|
245
505
|
/**
|
|
@@ -247,11 +507,34 @@ export class PlayRenderer {
|
|
|
247
507
|
* tree, because the container is empty already. Therefore this code resets the view
|
|
248
508
|
* identity. The next emission, also one with the same viewKey, then makes a
|
|
249
509
|
* complete render again. It does not patch a store that nothing shows.
|
|
510
|
+
*
|
|
511
|
+
* It releases the watch subscriptions of the dead tree too. A complete rebuild
|
|
512
|
+
* releases them before it builds again, and disconnect() releases them at the end of
|
|
513
|
+
* the life of the renderer — but a failure takes the DOM down HERE, between those two
|
|
514
|
+
* moments. Without this step one update of the store of the host runs every watch
|
|
515
|
+
* action of a tree that nothing shows, against detached elements, with `send` still
|
|
516
|
+
* bound to the actor. The fast path of a slice leaves a live tree of its own, and it
|
|
517
|
+
* reaches this code only when it fails.
|
|
250
518
|
*/
|
|
251
519
|
resetFailedRebuild() {
|
|
520
|
+
// Capture both, clear both, and set alive = false BEFORE the unsubscribe — the
|
|
521
|
+
// order of disconnect(). Some StateStore implementations fire a synchronous
|
|
522
|
+
// callback from inside their own unsubscribe(). Without the flag that callback
|
|
523
|
+
// passes the guard and runs incremental.update() on the tree that this method is
|
|
524
|
+
// taking down, with `send` still bound to the actor; without the capture it also
|
|
525
|
+
// overwrites watchCleanups before the loop below reaches it. render() sets the
|
|
526
|
+
// flag to true again on the complete rebuild that the next emission makes, and the
|
|
527
|
+
// fast path of a slice needs storeUnsubscribe, which is null from here.
|
|
252
528
|
const failedUnsub = this.storeUnsubscribe;
|
|
529
|
+
const failedWatchCleanups = [...this.watchCleanups];
|
|
253
530
|
this.storeUnsubscribe = null;
|
|
254
|
-
|
|
531
|
+
this.watchCleanups = new Set();
|
|
532
|
+
this.alive = false;
|
|
533
|
+
// See releaseQuietly. This method runs BEFORE contain(), so a throw here would take
|
|
534
|
+
// the place of the failure of the view that the renderer contains.
|
|
535
|
+
releaseQuietly(failedUnsub);
|
|
536
|
+
for (const cleanup of failedWatchCleanups)
|
|
537
|
+
releaseQuietly(cleanup);
|
|
255
538
|
this.lastViewKey = undefined;
|
|
256
539
|
this.currentStore = null;
|
|
257
540
|
this.storeLifecycle.reset();
|
|
@@ -356,7 +639,22 @@ export class PlayRenderer {
|
|
|
356
639
|
// callbacks synchronously inside its own unsubscribe() call.
|
|
357
640
|
if (!this.alive)
|
|
358
641
|
return;
|
|
359
|
-
|
|
642
|
+
// The try CONTAINS a failed update, exactly as the try of render() contains a
|
|
643
|
+
// failed rebuild. `incremental.update()` resolves the props of every element that
|
|
644
|
+
// the write touched, and it rebuilds the COMPLETE tree when the store hands back
|
|
645
|
+
// the snapshot that it held — so a `$computed` function that throws on the new
|
|
646
|
+
// state aborts the render here. This callback runs from inside `store.update()`,
|
|
647
|
+
// which an ACTION HANDLER of the host calls, so such a throw left the renderer
|
|
648
|
+
// through a path that no option of this class covers: `onError` heard nothing,
|
|
649
|
+
// the dead tree stayed on the screen, and the failure reached the caller of the
|
|
650
|
+
// action instead. The containment of a failure of the view is one rule, and it
|
|
651
|
+
// holds on every path that renders.
|
|
652
|
+
try {
|
|
653
|
+
incremental.update();
|
|
654
|
+
}
|
|
655
|
+
catch (error) {
|
|
656
|
+
this.failView(error);
|
|
657
|
+
}
|
|
360
658
|
});
|
|
361
659
|
incremental.render();
|
|
362
660
|
}
|
package/dist/PlayRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlayRenderer.js","sourceRoot":"","sources":["../src/PlayRenderer.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAIxF,OAAO,EAAE,yBAAyB,EAAE,MAAM,4BAA4B,CAAC;AAKvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,MAAM,OAAO,YAAY;IA2DN;IACA;IACA;IACA;IA7DV,OAAO,GAAwB,IAAI,CAAC;IACpC,gBAAgB,GAAwB,IAAI,CAAC;IACrD;;;;;;;OAOG;IACK,aAAa,GAAG,IAAI,GAAG,EAAc,CAAC;IAC9C;;;;;;;;;;OAUG;IACK,WAAW,GAAuB,SAAS,CAAC;IAC5C,YAAY,GAAsB,IAAI,CAAC;IAC/C;;;;;;;OAOG;IACc,cAAc,GAAuB,wBAAwB,CAAC,CAAC,IAAI,EAAE,EAAE,CACvF,qBAAqB,CAAC,EAAE,IAAI,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CACjD,CAAC;IACF;;;;;OAKG;IACK,KAAK,GAAG,IAAI,CAAC;IAErB;;;;;;;;;;;;;OAaG;IACH,YACkB,SAAsB,EACtB,KAA8C,EAC9C,QAAqB,EACrB,UAA0B,EAAE;QAH5B,cAAS,GAAT,SAAS,C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+EAA+E;YAC/E,oCAAoC;YACpC,IAAI,CAAC;gBACJ,WAAW,CAAC,MAAM,EAAE,CAAC;YACtB,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACtB,CAAC;QACF,CAAC,CAAC,CAAC;QACH,WAAW,CAAC,MAAM,EAAE,CAAC;IACtB,CAAC;CACD"}
|
package/dist/create-play-ui.d.ts
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* it returns a `disconnect` cleanup function.
|
|
7
7
|
*
|
|
8
8
|
* The factory holds the factory options (`functions`, `validationFunctions`,
|
|
9
|
-
* `navigate`, `onRenderError`, and `fallback`) from the moment of its
|
|
10
|
-
* it applies them on every `mount()` call. Give the mount options
|
|
11
|
-
* `loading`) to the `mount()` call itself, through `MountOptions`.
|
|
9
|
+
* `navigate`, `onRenderError`, `onError`, and `fallback`) from the moment of its
|
|
10
|
+
* creation, and it applies them on every `mount()` call. Give the mount options
|
|
11
|
+
* (`store` and `loading`) to the `mount()` call itself, through `MountOptions`.
|
|
12
12
|
*
|
|
13
13
|
* This factory is parallel to `<PlayUIProvider registryResult={...}>` in the
|
|
14
14
|
* framework renderers.
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
*
|
|
32
32
|
* @packageDocumentation
|
|
33
33
|
*/
|
|
34
|
+
import { type Cleanup } from "@xmachines/play";
|
|
34
35
|
import type { AbstractActor, Viewable } from "@xmachines/play-actor";
|
|
35
36
|
import type { AnyActorLogic } from "xstate";
|
|
36
37
|
import type { StateStore } from "@xmachines/json-render-core";
|
|
@@ -41,7 +42,8 @@ import type { CreatePlayUIOptions } from "./types.js";
|
|
|
41
42
|
*
|
|
42
43
|
* They replace or complete the factory options, for one actor and one container.
|
|
43
44
|
* The `createPlayUI` call sets the factory options (`functions`,
|
|
44
|
-
* `validationFunctions`, `navigate`, `onRenderError`, and `fallback`) one
|
|
45
|
+
* `validationFunctions`, `navigate`, `onRenderError`, `onError`, and `fallback`) one
|
|
46
|
+
* time.
|
|
45
47
|
*/
|
|
46
48
|
export interface MountOptions {
|
|
47
49
|
/**
|
|
@@ -63,8 +65,32 @@ export interface MountOptions {
|
|
|
63
65
|
* Call it with `(actor, container, mountOptions?)` to start the renderer.
|
|
64
66
|
* It returns a `disconnect` cleanup function. That function stops the render and
|
|
65
67
|
* clears the container.
|
|
68
|
+
*
|
|
69
|
+
* The return is a plain function here, because a consumer WRITES a value of this type
|
|
70
|
+
* to wrap or to stand in for a mount. A {@link Cleanup} return would refuse every such
|
|
71
|
+
* function that hands a plain release back. {@link DisposablePlayUI} narrows it for the
|
|
72
|
+
* value that {@link createPlayUI} builds, which nothing writes by hand.
|
|
66
73
|
*/
|
|
67
74
|
export type MountFn = (actor: AbstractActor<AnyActorLogic> & Viewable, container: HTMLElement, options?: MountOptions) => () => void;
|
|
75
|
+
/**
|
|
76
|
+
* The mount function that {@link createPlayUI} builds.
|
|
77
|
+
*
|
|
78
|
+
* It IS a {@link MountFn}, and it says one thing more: the mount hands back a
|
|
79
|
+
* {@link Cleanup}, so a caller may release it with `using` and write no teardown.
|
|
80
|
+
*
|
|
81
|
+
* ```ts
|
|
82
|
+
* const mount = createPlayUI(registryResult);
|
|
83
|
+
* {
|
|
84
|
+
* using stop = mount(actor, container);
|
|
85
|
+
* // stop() runs at the end of the scope, and after an exception too
|
|
86
|
+
* }
|
|
87
|
+
* ```
|
|
88
|
+
*
|
|
89
|
+
* A narrowed return and not a narrowed `MountFn`: the return type of a function may
|
|
90
|
+
* narrow, so this costs a consumer that writes a `MountFn` nothing. The parameters come
|
|
91
|
+
* from `MountFn` through `Parameters`, so the two signatures cannot drift.
|
|
92
|
+
*/
|
|
93
|
+
export type DisposablePlayUI = (...args: Parameters<MountFn>) => Cleanup;
|
|
68
94
|
/**
|
|
69
95
|
* Creates the mount function of the complete DOM renderer.
|
|
70
96
|
*
|
|
@@ -80,8 +106,12 @@ export type MountFn = (actor: AbstractActor<AnyActorLogic> & Viewable, container
|
|
|
80
106
|
* - `validationFunctions` — your own check functions. They are available at `ctx.ctx.validationFunctions`.
|
|
81
107
|
* - `navigate` — the navigation callback. The renderer calls it for `onSuccess: { navigate: "..." }`.
|
|
82
108
|
* - `onRenderError` — the `(error, name)` handler of a component render error and of an action handler rejection.
|
|
83
|
-
* - `
|
|
84
|
-
*
|
|
109
|
+
* - `onError` — the `(error, reset)` handler of a failure of a complete rebuild. The renderer
|
|
110
|
+
* contains such a failure always, and this option says where the report goes.
|
|
111
|
+
* - `fallback` — the content to show when the view of the actor is `null`, and after a contained
|
|
112
|
+
* failure of a rebuild. Give a FUNCTION when the factory mounts more than one
|
|
113
|
+
* time, so that each renderer owns its own element.
|
|
114
|
+
* @returns The {@link DisposablePlayUI}: `(actor, container, mountOptions?) → disconnect`
|
|
85
115
|
*/
|
|
86
|
-
export declare function createPlayUI(registryResult: DefineRegistryResult, options?: CreatePlayUIOptions):
|
|
116
|
+
export declare function createPlayUI(registryResult: DefineRegistryResult, options?: CreatePlayUIOptions): DisposablePlayUI;
|
|
87
117
|
//# sourceMappingURL=create-play-ui.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-play-ui.d.ts","sourceRoot":"","sources":["../src/create-play-ui.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD
|
|
1
|
+
{"version":3,"file":"create-play-ui.d.ts","sourceRoot":"","sources":["../src/create-play-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