@pyreon/state-tree 0.18.0 → 0.19.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/package.json +3 -3
- package/src/instance.ts +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pyreon/state-tree",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.0",
|
|
4
4
|
"description": "Structured reactive state tree — composable models with snapshots, patches, and middleware",
|
|
5
5
|
"homepage": "https://github.com/pyreon/pyreon/tree/main/packages/state-tree#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@happy-dom/global-registrator": "^20.8.9",
|
|
51
51
|
"@pyreon/manifest": "0.13.1",
|
|
52
|
-
"@pyreon/reactivity": "^0.
|
|
52
|
+
"@pyreon/reactivity": "^0.19.0",
|
|
53
53
|
"bun-types": "^1.3.12"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@pyreon/reactivity": "^0.
|
|
56
|
+
"@pyreon/reactivity": "^0.19.0"
|
|
57
57
|
}
|
|
58
58
|
}
|
package/src/instance.ts
CHANGED
|
@@ -69,6 +69,10 @@ export function createInstance<
|
|
|
69
69
|
})
|
|
70
70
|
|
|
71
71
|
// ── 1. State signals ──────────────────────────────────────────────────────
|
|
72
|
+
// Per-state-key signal allocation at instance CREATION (createInstance
|
|
73
|
+
// runs once per model instance), not per-render — this is the model's
|
|
74
|
+
// fine-grained reactive architecture, not the signal-in-render-loop
|
|
75
|
+
// anti-pattern the rule targets. Disabled per-site below with rationale.
|
|
72
76
|
for (const [key, defaultValue] of Object.entries(config.state)) {
|
|
73
77
|
meta.stateKeys.push(key)
|
|
74
78
|
const path = `/${key}`
|
|
@@ -83,6 +87,7 @@ export function createInstance<
|
|
|
83
87
|
defaultValue._config,
|
|
84
88
|
(initValue as Record<string, unknown>) ?? {},
|
|
85
89
|
)
|
|
90
|
+
// pyreon-lint-disable-next-line pyreon/no-signal-in-loop
|
|
86
91
|
rawSig = signal(nestedInstance)
|
|
87
92
|
|
|
88
93
|
// Propagate nested patches upward with the key as path prefix.
|
|
@@ -90,6 +95,7 @@ export function createInstance<
|
|
|
90
95
|
meta.emitPatch({ ...patch, path: path + patch.path })
|
|
91
96
|
})
|
|
92
97
|
} else {
|
|
98
|
+
// pyreon-lint-disable-next-line pyreon/no-signal-in-loop
|
|
93
99
|
rawSig = signal(initValue !== undefined ? initValue : defaultValue)
|
|
94
100
|
}
|
|
95
101
|
|