@plasmicapp/react-web 0.2.359 → 0.2.361
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 +12 -8
- package/dist/index.cjs.js.map +1 -1
- package/dist/react-web.esm.js +12 -8
- package/dist/react-web.esm.js.map +1 -1
- package/dist/stories/UseDollarState.stories.d.ts +1 -0
- package/package.json +2 -2
- package/skinny/dist/index.js +12 -8
- package/skinny/dist/index.js.map +1 -1
- package/skinny/dist/stories/UseDollarState.stories.d.ts +1 -0
package/dist/index.cjs.js
CHANGED
|
@@ -2240,11 +2240,16 @@ function create$StateProxy($$state, leafHandlers) {
|
|
|
2240
2240
|
Reflect.set(target, property, value, receiver);
|
|
2241
2241
|
if (nextSpec === null || nextSpec === void 0 ? void 0 : nextSpec.onChangeProp) {
|
|
2242
2242
|
var pathKey = JSON.stringify(nextPath);
|
|
2243
|
-
var isInitOnChange =
|
|
2243
|
+
var isInitOnChange =
|
|
2244
|
+
// If we are dealing with a valueProp it means that this state cell value is provided by the parent
|
|
2245
|
+
// and we don't need to consider initialization calls for it.
|
|
2246
|
+
!nextSpec.valueProp && !$$state.initializedLeafPaths.has(pathKey);
|
|
2244
2247
|
// 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
|
|
2248
|
+
// state can be updated with the correct value. We will provide an additional parameter
|
|
2246
2249
|
// 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,
|
|
2250
|
+
(_d = (_c = $$state.env.$props)[nextSpec.onChangeProp]) === null || _d === void 0 ? void 0 : _d.call(_c, value, {
|
|
2251
|
+
_plasmic_state_init_: isInitOnChange,
|
|
2252
|
+
});
|
|
2248
2253
|
if (isInitOnChange) {
|
|
2249
2254
|
$$state.initializedLeafPaths.add(pathKey);
|
|
2250
2255
|
}
|
|
@@ -2521,11 +2526,10 @@ function useDollarState(specs) {
|
|
|
2521
2526
|
useIsomorphicLayoutEffect(function () {
|
|
2522
2527
|
$$state.specTreeLeaves.forEach(function (node) {
|
|
2523
2528
|
var spec = node.getSpec();
|
|
2524
|
-
if (!spec.isRepeated && spec.type !== "private"
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
}
|
|
2529
|
+
if (!spec.isRepeated && spec.type !== "private") {
|
|
2530
|
+
// We only need to attempt to access the state cell to trigger initialization,
|
|
2531
|
+
// Check create$StateProxy for more details on how this works.
|
|
2532
|
+
getStateCellFrom$StateRoot($state, spec.pathObj);
|
|
2529
2533
|
}
|
|
2530
2534
|
});
|
|
2531
2535
|
}, []);
|