@plasmicapp/react-web 0.2.357 → 0.2.359
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/index.cjs.js +15 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/react-web.esm.js +15 -8
- package/dist/react-web.esm.js.map +1 -1
- package/dist/states/types.d.ts +1 -0
- package/package.json +2 -2
- package/skinny/dist/index.js +15 -8
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/states/types.d.ts +1 -0
package/dist/index.cjs.js
CHANGED
|
@@ -2111,7 +2111,7 @@ function subscribeToValtio($$state, statePath, node) {
|
|
|
2111
2111
|
}
|
|
2112
2112
|
}
|
|
2113
2113
|
function initializeStateValue($$state, initialStateCell, proxyRoot) {
|
|
2114
|
-
var _a
|
|
2114
|
+
var _a;
|
|
2115
2115
|
var initialStateName = initialStateCell.node.getSpec().path;
|
|
2116
2116
|
var stateAccess = new Set();
|
|
2117
2117
|
$$state.stateInitializationEnv.visited.add(initialStateName);
|
|
@@ -2168,16 +2168,12 @@ function initializeStateValue($$state, initialStateCell, proxyRoot) {
|
|
|
2168
2168
|
: clonedValue;
|
|
2169
2169
|
set(proxyRoot, initialStateCell.path, value);
|
|
2170
2170
|
}
|
|
2171
|
-
catch (
|
|
2171
|
+
catch (_b) {
|
|
2172
2172
|
// Setting the state to undefined to make sure it gets re-initialized
|
|
2173
2173
|
// in case it changes values.
|
|
2174
2174
|
initialStateCell.initialValue = undefined;
|
|
2175
2175
|
set(proxyRoot, initialStateCell.path, undefined);
|
|
2176
2176
|
}
|
|
2177
|
-
//immediately fire onChange
|
|
2178
|
-
if (initialSpec.onChangeProp) {
|
|
2179
|
-
(_c = (_b = $$state.env.$props)[initialSpec.onChangeProp]) === null || _c === void 0 ? void 0 : _c.call(_b, initialValue);
|
|
2180
|
-
}
|
|
2181
2177
|
$$state.stateInitializationEnv.visited.delete(initialStateName);
|
|
2182
2178
|
$$state.stateInitializationEnv.stack.pop();
|
|
2183
2179
|
return initialValue;
|
|
@@ -2243,7 +2239,15 @@ function create$StateProxy($$state, leafHandlers) {
|
|
|
2243
2239
|
(_b = (_a = leafHandlers(ensureStateCell(receiver, property, nextPath, nextNode))).set) === null || _b === void 0 ? void 0 : _b.call(_a, target, property, value, receiver);
|
|
2244
2240
|
Reflect.set(target, property, value, receiver);
|
|
2245
2241
|
if (nextSpec === null || nextSpec === void 0 ? void 0 : nextSpec.onChangeProp) {
|
|
2246
|
-
|
|
2242
|
+
var pathKey = JSON.stringify(nextPath);
|
|
2243
|
+
var isInitOnChange = !$$state.initializedLeafPaths.has(pathKey);
|
|
2244
|
+
// We need to call the onChangeProp during initialization process so that the parent
|
|
2245
|
+
// state can be updated with the correct value. We will provide an addtionnal parameter
|
|
2246
|
+
// to the onChangeProp function to indicate that the call is made during initialization.
|
|
2247
|
+
(_d = (_c = $$state.env.$props)[nextSpec.onChangeProp]) === null || _d === void 0 ? void 0 : _d.call(_c, value, isInitOnChange);
|
|
2248
|
+
if (isInitOnChange) {
|
|
2249
|
+
$$state.initializedLeafPaths.add(pathKey);
|
|
2250
|
+
}
|
|
2247
2251
|
}
|
|
2248
2252
|
}
|
|
2249
2253
|
if (!nextNode) {
|
|
@@ -2368,6 +2372,7 @@ function useDollarState(specs) {
|
|
|
2368
2372
|
specs: [],
|
|
2369
2373
|
registrationsQueue: [],
|
|
2370
2374
|
stateInitializationEnv: { stack: [], visited: new Set() },
|
|
2375
|
+
initializedLeafPaths: new Set(),
|
|
2371
2376
|
};
|
|
2372
2377
|
})()).current;
|
|
2373
2378
|
$$state.env = envFieldsAreNonNill(env);
|
|
@@ -2518,7 +2523,9 @@ function useDollarState(specs) {
|
|
|
2518
2523
|
var spec = node.getSpec();
|
|
2519
2524
|
if (!spec.isRepeated && spec.type !== "private" && spec.initFunc) {
|
|
2520
2525
|
var stateCell = getStateCellFrom$StateRoot($state, spec.pathObj);
|
|
2521
|
-
|
|
2526
|
+
if (stateCell.initialValue === UNINITIALIZED) {
|
|
2527
|
+
initializeStateValue($$state, stateCell, $state);
|
|
2528
|
+
}
|
|
2522
2529
|
}
|
|
2523
2530
|
});
|
|
2524
2531
|
}, []);
|