@praxisjs/runtime 0.2.15 → 0.2.16
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/CHANGELOG.md +16 -3
- package/dist/reactive.d.ts.map +1 -1
- package/dist/reactive.js +5 -1
- package/dist/reactive.js.map +1 -1
- package/package.json +2 -2
- package/src/reactive.ts +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @praxisjs/runtime
|
|
2
2
|
|
|
3
|
+
## 0.2.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- bb4d00a: Fix `mountReactive` silently dropping DOM updates when the reactive node lives inside a component.
|
|
8
|
+
|
|
9
|
+
`mountReactive` captured `parent` (the container passed by `mountComponent`, a `DocumentFragment`) by closure. After `mountComponent` returns, the fragment's child nodes are transferred to the actual DOM element — leaving the fragment empty. When a signal change triggered the reactive effect to re-run, `parent.insertBefore(n, end)` failed silently because `end` was no longer a child of the stale `parent` reference.
|
|
10
|
+
|
|
11
|
+
The fix uses `end.parentNode ?? parent` as the insertion anchor, which always resolves to the live DOM parent after the fragment has been consumed. This affects any reactive expression (`{() => ...}`) returned from a component's `render()` method, including `@Lazy`, `@StateMachine` state-dependent renders, and the `onError` pattern from the docs.
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [954e456]
|
|
14
|
+
- Updated dependencies [a0bf339]
|
|
15
|
+
- Updated dependencies [a0bf339]
|
|
16
|
+
- Updated dependencies [a8df1e1]
|
|
17
|
+
- @praxisjs/decorators@1.0.0
|
|
18
|
+
|
|
3
19
|
## 0.2.15
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -54,7 +70,6 @@
|
|
|
54
70
|
- 6c353ba: Add `untrack` utility and isolate component mounting from outer reactive contexts
|
|
55
71
|
|
|
56
72
|
**`@praxisjs/core`** exports two new functions from the public API:
|
|
57
|
-
|
|
58
73
|
- `peek(signal)` — reads a signal once without subscribing to it (was already in `/internal`, now public)
|
|
59
74
|
- `untrack(fn)` — runs a function with no active effect, suppressing all signal tracking inside it
|
|
60
75
|
|
|
@@ -71,7 +86,6 @@
|
|
|
71
86
|
```
|
|
72
87
|
|
|
73
88
|
**`@praxisjs/runtime`** — `mountComponent` now runs entirely inside `untrack`. This fixes a bug where components mounted inside a reactive context (e.g. the router) would accidentally subscribe the outer effect to any signal read during construction or render. The symptoms were:
|
|
74
|
-
|
|
75
89
|
- Eager reads like `description={this.count}` in JSX causing the router to re-mount the component on every state change, resetting state to its initial value
|
|
76
90
|
- `@Debug()` (and any decorator that reads a signal in its `addInitializer`) triggering the same re-mount loop
|
|
77
91
|
|
|
@@ -155,7 +169,6 @@
|
|
|
155
169
|
### Minor Changes
|
|
156
170
|
|
|
157
171
|
- bb0d4f8: **Refactor decorator system and component architecture across PraxisJS packages**
|
|
158
|
-
|
|
159
172
|
- Replaced legacy decorator signatures (`constructor`, `target`, `propertyKey`, method descriptor) with the standard TC39 decorator context API (`ClassDecoratorContext`, `ClassFieldDecoratorContext`, `ClassMethodDecoratorContext`) across `@praxisjs/decorators`, `@praxisjs/store`, `@praxisjs/concurrent`, `@praxisjs/router`, `@praxisjs/motion`, `@praxisjs/di`, and `@praxisjs/fsm`.
|
|
160
173
|
- Introduced `StatefulComponent` and `StatelessComponent` as the new base classes, replacing the deprecated `BaseComponent`/`Function Component` pattern, across `@praxisjs/core`, `@praxisjs/runtime`, `@praxisjs/devtools`, and templates.
|
|
161
174
|
- Implemented core rendering functionality in `@praxisjs/runtime` (`mountChildren`, `mountComponent`, reactive scope management) and removed the deprecated `renderer.ts`.
|
package/dist/reactive.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactive.d.ts","sourceRoot":"","sources":["../src/reactive.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAYrC,wBAAgB,aAAa,CAC3B,MAAM,EAAE,IAAI,EACZ,EAAE,EAAE,MAAM,OAAO,EACjB,WAAW,EAAE,KAAK,GACjB,IAAI,
|
|
1
|
+
{"version":3,"file":"reactive.d.ts","sourceRoot":"","sources":["../src/reactive.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAYrC,wBAAgB,aAAa,CAC3B,MAAM,EAAE,IAAI,EACZ,EAAE,EAAE,MAAM,OAAO,EACjB,WAAW,EAAE,KAAK,GACjB,IAAI,CA8BN"}
|
package/dist/reactive.js
CHANGED
|
@@ -25,8 +25,12 @@ export function mountReactive(parent, fn, parentScope) {
|
|
|
25
25
|
currentNodes = [];
|
|
26
26
|
const result = runInScope(childScope, fn);
|
|
27
27
|
const newNodes = normalizeToNodes(result);
|
|
28
|
+
// Use end.parentNode instead of the original `parent` — the parent
|
|
29
|
+
// reference may be a DocumentFragment that was emptied after its
|
|
30
|
+
// children were transferred to the real DOM by mountComponent.
|
|
31
|
+
const anchor = end.parentNode ?? parent;
|
|
28
32
|
for (const n of newNodes) {
|
|
29
|
-
|
|
33
|
+
anchor.insertBefore(n, end);
|
|
30
34
|
}
|
|
31
35
|
currentNodes = newNodes;
|
|
32
36
|
});
|
package/dist/reactive.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reactive.js","sourceRoot":"","sources":["../src/reactive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAIvC,SAAS,gBAAgB,CAAC,KAAc;IACtC,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,KAAK;QAAE,OAAO,EAAE,CAAC;IACxE,IAAI,KAAK,YAAY,IAAI;QAAE,OAAO,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,C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,QAAQ,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;QAE1C,mEAAmE;QACnE,iEAAiE;QACjE,+DAA+D;QAC/D,MAAM,MAAM,GAAG,GAAG,CAAC,UAAU,IAAI,MAAM,CAAC;QACxC,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;YACzB,MAAM,CAAC,YAAY,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC9B,CAAC;QACD,YAAY,GAAG,QAAQ,CAAC;IAC1B,CAAC,CAAC,CAAC;IAEH,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@praxisjs/runtime",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.16",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@praxisjs/core": "1.5.0",
|
|
18
|
-
"@praxisjs/decorators": "0.
|
|
18
|
+
"@praxisjs/decorators": "1.0.0",
|
|
19
19
|
"@praxisjs/shared": "0.2.0"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
package/src/reactive.ts
CHANGED
|
@@ -35,8 +35,12 @@ export function mountReactive(
|
|
|
35
35
|
const result = runInScope(childScope, fn);
|
|
36
36
|
const newNodes = normalizeToNodes(result);
|
|
37
37
|
|
|
38
|
+
// Use end.parentNode instead of the original `parent` — the parent
|
|
39
|
+
// reference may be a DocumentFragment that was emptied after its
|
|
40
|
+
// children were transferred to the real DOM by mountComponent.
|
|
41
|
+
const anchor = end.parentNode ?? parent;
|
|
38
42
|
for (const n of newNodes) {
|
|
39
|
-
|
|
43
|
+
anchor.insertBefore(n, end);
|
|
40
44
|
}
|
|
41
45
|
currentNodes = newNodes;
|
|
42
46
|
});
|