@xmachines/play-react 2.0.0 → 2.1.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 +48 -31
- package/dist/ActorProvider.d.ts +24 -20
- package/dist/ActorProvider.d.ts.map +1 -1
- package/dist/ActorProvider.js +97 -83
- package/dist/ActorProvider.js.map +1 -1
- package/dist/PlayErrorBoundary.d.ts +15 -14
- package/dist/PlayErrorBoundary.d.ts.map +1 -1
- package/dist/PlayErrorBoundary.js +10 -9
- package/dist/PlayErrorBoundary.js.map +1 -1
- package/dist/PlayRenderer.d.ts +10 -9
- package/dist/PlayRenderer.d.ts.map +1 -1
- package/dist/PlayRenderer.js +10 -9
- package/dist/PlayRenderer.js.map +1 -1
- package/dist/PlayUIProvider.d.ts +12 -11
- package/dist/PlayUIProvider.d.ts.map +1 -1
- package/dist/PlayUIProvider.js +19 -15
- package/dist/PlayUIProvider.js.map +1 -1
- package/dist/index.d.ts +19 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -18
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +3 -3
- package/dist/types.js +3 -3
- package/dist/useActor.d.ts +7 -5
- package/dist/useActor.d.ts.map +1 -1
- package/dist/useActor.js +4 -4
- package/dist/useActor.js.map +1 -1
- package/dist/useSignalEffect.d.ts +40 -39
- package/dist/useSignalEffect.d.ts.map +1 -1
- package/dist/useSignalEffect.js +61 -58
- package/dist/useSignalEffect.js.map +1 -1
- package/package.json +5 -4
- package/dist/errors.d.ts +0 -23
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -26
- package/dist/errors.js.map +0 -1
|
@@ -1,71 +1,72 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* useSignalEffect - React hook
|
|
2
|
+
* useSignalEffect - the React hook that subscribes to a signal and cleans up by itself
|
|
3
3
|
*
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
6
|
import type { DependencyList } from "react";
|
|
7
7
|
/**
|
|
8
|
-
* React hook that subscribes to signal changes and runs effect callback
|
|
8
|
+
* The React hook that subscribes to the signal changes and runs an effect callback
|
|
9
9
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
10
|
+
* The hook puts the callback in a Signal.Computed, which tracks each signal that
|
|
11
|
+
* the callback reads. It then gives the watcher lifecycle to `watchSignal` from
|
|
12
|
+
* `@xmachines/play-signals`. That function does the microtask batching, the new arm
|
|
13
|
+
* of the watcher, and the disposal. It is the one canonical implementation, and
|
|
14
|
+
* every framework renderer uses it.
|
|
15
15
|
*
|
|
16
16
|
* Architecture:
|
|
17
|
-
* -
|
|
18
|
-
* - watchSignal owns the Signal.subtle.Watcher lifecycle (Phase 29 memory safety)
|
|
19
|
-
* -
|
|
20
|
-
* -
|
|
21
|
-
* -
|
|
17
|
+
* - The hook puts the callback in a Signal.Computed for the dependency tracking
|
|
18
|
+
* - watchSignal owns the Signal.subtle.Watcher lifecycle (Phase 29, memory safety)
|
|
19
|
+
* - The microtask batching groups rapid signal updates
|
|
20
|
+
* - The callback triggers each new render with its own setState (see the remarks)
|
|
21
|
+
* - The hook cleans up on unmount, so that nothing stays in memory
|
|
22
22
|
*
|
|
23
|
-
* Invariant: Signal-Only Reactivity
|
|
24
|
-
* Invariant: Passive Infrastructure
|
|
23
|
+
* Invariant: Signal-Only Reactivity. The hook watches each signal that the callback reads.
|
|
24
|
+
* Invariant: Passive Infrastructure. React observes the signals, and it does not control them.
|
|
25
25
|
*
|
|
26
|
-
* @param callback -
|
|
27
|
-
* @param deps -
|
|
28
|
-
*
|
|
29
|
-
* signals from
|
|
30
|
-
* when the identity of the object whose signals
|
|
31
|
-
*
|
|
32
|
-
*
|
|
26
|
+
* @param callback - The effect function that reads the signals. It can return a cleanup function.
|
|
27
|
+
* @param deps - The optional dependency list, as in useEffect. On a change of one
|
|
28
|
+
* dependency, the hook removes the watcher and the Computed, then makes them again
|
|
29
|
+
* and tracks the signals from the start. The default is `[]`, which subscribes one
|
|
30
|
+
* time for each mount. Give this list when the identity of the object whose signals
|
|
31
|
+
* you read can change during the life of the component, for example an `actor`
|
|
32
|
+
* prop. Without the list, the watcher tracks the signals of the OLD object for
|
|
33
|
+
* ever.
|
|
33
34
|
*
|
|
34
35
|
* @example
|
|
35
36
|
* ```typescript
|
|
36
37
|
* const MyComponent = ({ actor }) => {
|
|
37
38
|
* const [view, setView] = useState(null);
|
|
38
39
|
*
|
|
39
|
-
* // Subscribe to actor.currentView signal
|
|
40
|
+
* // Subscribe to the actor.currentView signal, and subscribe again on a new actor
|
|
40
41
|
* useSignalEffect(() => {
|
|
41
42
|
* const currentView = actor.currentView.get();
|
|
42
43
|
* setView(currentView);
|
|
43
44
|
* }, [actor]);
|
|
44
45
|
*
|
|
45
|
-
* return <div>{view?.
|
|
46
|
+
* return <div>{view?.root}</div>;
|
|
46
47
|
* };
|
|
47
48
|
* ```
|
|
48
49
|
*
|
|
49
50
|
* @remarks
|
|
50
|
-
* **CRITICAL:**
|
|
51
|
-
*
|
|
51
|
+
* **CRITICAL:** read each signal unconditionally, with no `if` statement. A
|
|
52
|
+
* conditional read breaks the dependency tracking.
|
|
52
53
|
*
|
|
53
|
-
* **Performance:**
|
|
54
|
-
*
|
|
54
|
+
* **Performance:** the microtask batching (queueMicrotask, inside watchSignal)
|
|
55
|
+
* stops a flood of React renders when several signals update in rapid sequence.
|
|
55
56
|
*
|
|
56
|
-
* **Re-rendering:** the hook itself does NOT force a React render on signal
|
|
57
|
-
* change
|
|
58
|
-
* signal value
|
|
59
|
-
* skip
|
|
60
|
-
* force-update here
|
|
61
|
-
* when the callback
|
|
62
|
-
* notification
|
|
63
|
-
* into React state inside the callback.
|
|
57
|
+
* **Re-rendering:** the hook itself does NOT force a React render on a signal
|
|
58
|
+
* change. The callback triggers each new render, because it calls setState with the
|
|
59
|
+
* new signal value, as in the example above. The setState bailout of React can
|
|
60
|
+
* therefore skip a render when the derived value is the same. An unconditional
|
|
61
|
+
* force-update here caused one wasted render for each notification before, also
|
|
62
|
+
* when the setState of the callback made the bailout. If you must render again on
|
|
63
|
+
* every notification, and you read the signals during the render, copy the signal
|
|
64
|
+
* value into the React state inside the callback.
|
|
64
65
|
*
|
|
65
|
-
* **Implementation note:**
|
|
66
|
-
* Signal.subtle.Watcher cannot
|
|
67
|
-
*
|
|
68
|
-
*
|
|
66
|
+
* **Implementation note:** the hook puts the callback in a Signal.Computed, because
|
|
67
|
+
* Signal.subtle.Watcher cannot track an arbitrary function call. The Computed does
|
|
68
|
+
* the dependency tracking. watchSignal evaluates the Computed, which runs the
|
|
69
|
+
* callback, on each change of a tracked signal.
|
|
69
70
|
*/
|
|
70
71
|
export declare const useSignalEffect: (callback: () => void | (() => void), deps?: DependencyList) => void;
|
|
71
72
|
//# sourceMappingURL=useSignalEffect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSignalEffect.d.ts","sourceRoot":"","sources":["../src/useSignalEffect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAS5C
|
|
1
|
+
{"version":3,"file":"useSignalEffect.d.ts","sourceRoot":"","sources":["../src/useSignalEffect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAS5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,eAAO,MAAM,eAAe,GAC3B,UAAU,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,EACnC,OAAM,cAAmB,KACvB,IA4CF,CAAC"}
|
package/dist/useSignalEffect.js
CHANGED
|
@@ -1,109 +1,112 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* useSignalEffect - React hook
|
|
2
|
+
* useSignalEffect - the React hook that subscribes to a signal and cleans up by itself
|
|
3
3
|
*
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
6
|
import { useEffect, useRef } from "react";
|
|
7
7
|
import { Signal, watchSignal } from "@xmachines/play-signals";
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* The
|
|
9
|
+
* The marker symbol that the effect Computed returns, to satisfy the type.
|
|
10
|
+
* The value has no meaning. Only the side effects are important.
|
|
11
11
|
*/
|
|
12
12
|
const EFFECT_RUN_MARKER = Symbol("effect-run");
|
|
13
13
|
/**
|
|
14
|
-
* React hook that subscribes to signal changes and runs effect callback
|
|
14
|
+
* The React hook that subscribes to the signal changes and runs an effect callback
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* The hook puts the callback in a Signal.Computed, which tracks each signal that
|
|
17
|
+
* the callback reads. It then gives the watcher lifecycle to `watchSignal` from
|
|
18
|
+
* `@xmachines/play-signals`. That function does the microtask batching, the new arm
|
|
19
|
+
* of the watcher, and the disposal. It is the one canonical implementation, and
|
|
20
|
+
* every framework renderer uses it.
|
|
21
21
|
*
|
|
22
22
|
* Architecture:
|
|
23
|
-
* -
|
|
24
|
-
* - watchSignal owns the Signal.subtle.Watcher lifecycle (Phase 29 memory safety)
|
|
25
|
-
* -
|
|
26
|
-
* -
|
|
27
|
-
* -
|
|
23
|
+
* - The hook puts the callback in a Signal.Computed for the dependency tracking
|
|
24
|
+
* - watchSignal owns the Signal.subtle.Watcher lifecycle (Phase 29, memory safety)
|
|
25
|
+
* - The microtask batching groups rapid signal updates
|
|
26
|
+
* - The callback triggers each new render with its own setState (see the remarks)
|
|
27
|
+
* - The hook cleans up on unmount, so that nothing stays in memory
|
|
28
28
|
*
|
|
29
|
-
* Invariant: Signal-Only Reactivity
|
|
30
|
-
* Invariant: Passive Infrastructure
|
|
29
|
+
* Invariant: Signal-Only Reactivity. The hook watches each signal that the callback reads.
|
|
30
|
+
* Invariant: Passive Infrastructure. React observes the signals, and it does not control them.
|
|
31
31
|
*
|
|
32
|
-
* @param callback -
|
|
33
|
-
* @param deps -
|
|
34
|
-
*
|
|
35
|
-
* signals from
|
|
36
|
-
* when the identity of the object whose signals
|
|
37
|
-
*
|
|
38
|
-
*
|
|
32
|
+
* @param callback - The effect function that reads the signals. It can return a cleanup function.
|
|
33
|
+
* @param deps - The optional dependency list, as in useEffect. On a change of one
|
|
34
|
+
* dependency, the hook removes the watcher and the Computed, then makes them again
|
|
35
|
+
* and tracks the signals from the start. The default is `[]`, which subscribes one
|
|
36
|
+
* time for each mount. Give this list when the identity of the object whose signals
|
|
37
|
+
* you read can change during the life of the component, for example an `actor`
|
|
38
|
+
* prop. Without the list, the watcher tracks the signals of the OLD object for
|
|
39
|
+
* ever.
|
|
39
40
|
*
|
|
40
41
|
* @example
|
|
41
42
|
* ```typescript
|
|
42
43
|
* const MyComponent = ({ actor }) => {
|
|
43
44
|
* const [view, setView] = useState(null);
|
|
44
45
|
*
|
|
45
|
-
* // Subscribe to actor.currentView signal
|
|
46
|
+
* // Subscribe to the actor.currentView signal, and subscribe again on a new actor
|
|
46
47
|
* useSignalEffect(() => {
|
|
47
48
|
* const currentView = actor.currentView.get();
|
|
48
49
|
* setView(currentView);
|
|
49
50
|
* }, [actor]);
|
|
50
51
|
*
|
|
51
|
-
* return <div>{view?.
|
|
52
|
+
* return <div>{view?.root}</div>;
|
|
52
53
|
* };
|
|
53
54
|
* ```
|
|
54
55
|
*
|
|
55
56
|
* @remarks
|
|
56
|
-
* **CRITICAL:**
|
|
57
|
-
*
|
|
57
|
+
* **CRITICAL:** read each signal unconditionally, with no `if` statement. A
|
|
58
|
+
* conditional read breaks the dependency tracking.
|
|
58
59
|
*
|
|
59
|
-
* **Performance:**
|
|
60
|
-
*
|
|
60
|
+
* **Performance:** the microtask batching (queueMicrotask, inside watchSignal)
|
|
61
|
+
* stops a flood of React renders when several signals update in rapid sequence.
|
|
61
62
|
*
|
|
62
|
-
* **Re-rendering:** the hook itself does NOT force a React render on signal
|
|
63
|
-
* change
|
|
64
|
-
* signal value
|
|
65
|
-
* skip
|
|
66
|
-
* force-update here
|
|
67
|
-
* when the callback
|
|
68
|
-
* notification
|
|
69
|
-
* into React state inside the callback.
|
|
63
|
+
* **Re-rendering:** the hook itself does NOT force a React render on a signal
|
|
64
|
+
* change. The callback triggers each new render, because it calls setState with the
|
|
65
|
+
* new signal value, as in the example above. The setState bailout of React can
|
|
66
|
+
* therefore skip a render when the derived value is the same. An unconditional
|
|
67
|
+
* force-update here caused one wasted render for each notification before, also
|
|
68
|
+
* when the setState of the callback made the bailout. If you must render again on
|
|
69
|
+
* every notification, and you read the signals during the render, copy the signal
|
|
70
|
+
* value into the React state inside the callback.
|
|
70
71
|
*
|
|
71
|
-
* **Implementation note:**
|
|
72
|
-
* Signal.subtle.Watcher cannot
|
|
73
|
-
*
|
|
74
|
-
*
|
|
72
|
+
* **Implementation note:** the hook puts the callback in a Signal.Computed, because
|
|
73
|
+
* Signal.subtle.Watcher cannot track an arbitrary function call. The Computed does
|
|
74
|
+
* the dependency tracking. watchSignal evaluates the Computed, which runs the
|
|
75
|
+
* callback, on each change of a tracked signal.
|
|
75
76
|
*/
|
|
76
77
|
export const useSignalEffect = (callback, deps = []) => {
|
|
77
|
-
//
|
|
78
|
-
//
|
|
78
|
+
// A ref holds the callback. The closure of the effect therefore always calls the
|
|
79
|
+
// newest callback, and the code removes the watcher on each render NOT and installs it
|
|
80
|
+
// again NOT. This is the standard ref pattern of React.
|
|
79
81
|
const callbackRef = useRef(callback);
|
|
80
|
-
//
|
|
82
|
+
// The assignment is outside useEffect. The ref therefore holds the newest value, and no effect runs again
|
|
81
83
|
callbackRef.current = callback;
|
|
82
84
|
useEffect(() => {
|
|
83
85
|
let cleanup;
|
|
84
|
-
//
|
|
85
|
-
// The Computed
|
|
86
|
+
// Put the callback in a Computed, which tracks each dependency.
|
|
87
|
+
// The Computed evaluates the callback again after a change of a signal that the
|
|
88
|
+
// callback reads.
|
|
86
89
|
const effect = new Signal.Computed(() => {
|
|
87
|
-
// Run cleanup
|
|
90
|
+
// Run the cleanup of the previous effect
|
|
88
91
|
if (typeof cleanup === "function")
|
|
89
92
|
cleanup();
|
|
90
|
-
// Run
|
|
93
|
+
// Run the callback of the user through the ref. It is always the newest one, and the deps therefore change not
|
|
91
94
|
cleanup = callbackRef.current();
|
|
92
|
-
// Return marker value
|
|
95
|
+
// Return the marker value, because a Computed requires a return value
|
|
93
96
|
return EFFECT_RUN_MARKER;
|
|
94
97
|
});
|
|
95
|
-
// watchSignal owns the watcher
|
|
96
|
-
// guard, and
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
//
|
|
98
|
+
// watchSignal owns the lifecycle of the watcher: the batching in a microtask, the
|
|
99
|
+
// guard of a disposal, and the new arm after each notification. The memory safety of
|
|
100
|
+
// Phase 29 is there, in one place, and no file holds a copy of the watcher code.
|
|
101
|
+
// The read of the Computed inside watchSignal evaluates it again, and that run calls
|
|
102
|
+
// the callback of the user. The callback starts each new render with its setState.
|
|
103
|
+
// Therefore onValue needs no more work.
|
|
101
104
|
const unwatch = watchSignal(effect, () => { });
|
|
102
|
-
//
|
|
105
|
+
// The first run of the callback, through the Computed
|
|
103
106
|
effect.get();
|
|
104
|
-
//
|
|
107
|
+
// The cleanup, on an unmount and on a change of the deps
|
|
105
108
|
return () => {
|
|
106
|
-
// Stop
|
|
109
|
+
// Stop the signal updates. The call is idempotent, and it disposes of each microtask that waits
|
|
107
110
|
unwatch();
|
|
108
111
|
if (typeof cleanup === "function")
|
|
109
112
|
cleanup();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSignalEffect.js","sourceRoot":"","sources":["../src/useSignalEffect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;GAGG;AACH,MAAM,iBAAiB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAE/C
|
|
1
|
+
{"version":3,"file":"useSignalEffect.js","sourceRoot":"","sources":["../src/useSignalEffect.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9D;;;GAGG;AACH,MAAM,iBAAiB,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAC9B,QAAmC,EACnC,OAAuB,EAAE,EAClB,EAAE;IACT,iFAAiF;IACjF,uFAAuF;IACvF,wDAAwD;IACxD,MAAM,WAAW,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC;IACrC,0GAA0G;IAC1G,WAAW,CAAC,OAAO,GAAG,QAAQ,CAAC;IAE/B,SAAS,CAAC,GAAG,EAAE;QACd,IAAI,OAA4B,CAAC;QAEjC,gEAAgE;QAChE,gFAAgF;QAChF,kBAAkB;QAClB,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE;YACvC,yCAAyC;YACzC,IAAI,OAAO,OAAO,KAAK,UAAU;gBAAE,OAAO,EAAE,CAAC;YAE7C,+GAA+G;YAC/G,OAAO,GAAG,WAAW,CAAC,OAAO,EAAE,CAAC;YAEhC,sEAAsE;YACtE,OAAO,iBAAiB,CAAC;QAC1B,CAAC,CAAC,CAAC;QAEH,kFAAkF;QAClF,qFAAqF;QACrF,iFAAiF;QACjF,qFAAqF;QACrF,mFAAmF;QACnF,wCAAwC;QACxC,MAAM,OAAO,GAAG,WAAW,CAAC,MAAkC,EAAE,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAE1E,sDAAsD;QACtD,MAAM,CAAC,GAAG,EAAE,CAAC;QAEb,yDAAyD;QACzD,OAAO,GAAG,EAAE;YACX,gGAAgG;YAChG,OAAO,EAAE,CAAC;YACV,IAAI,OAAO,OAAO,KAAK,UAAU;gBAAE,OAAO,EAAE,CAAC;QAC9C,CAAC,CAAC;QACF,wHAAwH;IACzH,CAAC,EAAE,IAAI,CAAC,CAAC;AACV,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xmachines/play-react",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "React renderer for XMachines Play architecture with signal-driven rendering",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"actor",
|
|
@@ -43,13 +43,14 @@
|
|
|
43
43
|
"lint": "oxlint .",
|
|
44
44
|
"format": "oxfmt .",
|
|
45
45
|
"test": "vitest",
|
|
46
|
+
"test:coverage": "vitest run --coverage",
|
|
46
47
|
"test:vitest": "vitest run",
|
|
47
48
|
"test:browser": "vitest --browser.enabled --browser.name=chromium test/browser"
|
|
48
49
|
},
|
|
49
50
|
"dependencies": {
|
|
50
|
-
"@xmachines/play": "2.
|
|
51
|
-
"@xmachines/play-actor": "2.
|
|
52
|
-
"@xmachines/play-signals": "2.
|
|
51
|
+
"@xmachines/play": "2.1.0",
|
|
52
|
+
"@xmachines/play-actor": "2.1.0",
|
|
53
|
+
"@xmachines/play-signals": "2.1.0"
|
|
53
54
|
},
|
|
54
55
|
"devDependencies": {
|
|
55
56
|
"@testing-library/jest-dom": "^6.9.1",
|
package/dist/errors.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { PlayError } from "@xmachines/play";
|
|
2
|
-
/**
|
|
3
|
-
* Error class for renderer-level errors in the Play architecture.
|
|
4
|
-
*
|
|
5
|
-
* **Note (Phase 29):** `PlayErrorBoundary.componentDidCatch()` no longer throws
|
|
6
|
-
* this error. Re-throwing from `componentDidCatch` can unmount the entire React 19
|
|
7
|
-
* root. `RendererError` is retained for programmatic use in custom error handlers
|
|
8
|
-
* and parent boundaries — it is no longer emitted by the built-in boundary itself.
|
|
9
|
-
*
|
|
10
|
-
* **Error code:** `PLAY_REACT_RENDER_ERROR`
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import { RendererError } from "@xmachines/play-react/errors";
|
|
15
|
-
*
|
|
16
|
-
* // Create a RendererError programmatically in a custom boundary:
|
|
17
|
-
* throw new RendererError("Custom render failure", { cause: originalError });
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export declare class RendererError extends PlayError {
|
|
21
|
-
constructor(message: string, options?: ErrorOptions);
|
|
22
|
-
}
|
|
23
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,aAAc,SAAQ,SAAS;gBAC/B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAInD"}
|
package/dist/errors.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { PlayError } from "@xmachines/play";
|
|
2
|
-
/**
|
|
3
|
-
* Error class for renderer-level errors in the Play architecture.
|
|
4
|
-
*
|
|
5
|
-
* **Note (Phase 29):** `PlayErrorBoundary.componentDidCatch()` no longer throws
|
|
6
|
-
* this error. Re-throwing from `componentDidCatch` can unmount the entire React 19
|
|
7
|
-
* root. `RendererError` is retained for programmatic use in custom error handlers
|
|
8
|
-
* and parent boundaries — it is no longer emitted by the built-in boundary itself.
|
|
9
|
-
*
|
|
10
|
-
* **Error code:** `PLAY_REACT_RENDER_ERROR`
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```typescript
|
|
14
|
-
* import { RendererError } from "@xmachines/play-react/errors";
|
|
15
|
-
*
|
|
16
|
-
* // Create a RendererError programmatically in a custom boundary:
|
|
17
|
-
* throw new RendererError("Custom render failure", { cause: originalError });
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export class RendererError extends PlayError {
|
|
21
|
-
constructor(message, options) {
|
|
22
|
-
super("PlayRenderer", "PLAY_REACT_RENDER_ERROR", message, options);
|
|
23
|
-
this.name = "RendererError";
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
//# sourceMappingURL=errors.js.map
|
package/dist/errors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC3C,YAAY,OAAe,EAAE,OAAsB;QAClD,KAAK,CAAC,cAAc,EAAE,yBAAyB,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACnE,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC7B,CAAC;CACD"}
|