@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/react-web.esm.js
CHANGED
|
@@ -2221,11 +2221,16 @@ function create$StateProxy($$state, leafHandlers) {
|
|
|
2221
2221
|
Reflect.set(target, property, value, receiver);
|
|
2222
2222
|
if (nextSpec === null || nextSpec === void 0 ? void 0 : nextSpec.onChangeProp) {
|
|
2223
2223
|
var pathKey = JSON.stringify(nextPath);
|
|
2224
|
-
var isInitOnChange =
|
|
2224
|
+
var isInitOnChange =
|
|
2225
|
+
// If we are dealing with a valueProp it means that this state cell value is provided by the parent
|
|
2226
|
+
// and we don't need to consider initialization calls for it.
|
|
2227
|
+
!nextSpec.valueProp && !$$state.initializedLeafPaths.has(pathKey);
|
|
2225
2228
|
// We need to call the onChangeProp during initialization process so that the parent
|
|
2226
|
-
// state can be updated with the correct value. We will provide an
|
|
2229
|
+
// state can be updated with the correct value. We will provide an additional parameter
|
|
2227
2230
|
// to the onChangeProp function to indicate that the call is made during initialization.
|
|
2228
|
-
(_d = (_c = $$state.env.$props)[nextSpec.onChangeProp]) === null || _d === void 0 ? void 0 : _d.call(_c, value,
|
|
2231
|
+
(_d = (_c = $$state.env.$props)[nextSpec.onChangeProp]) === null || _d === void 0 ? void 0 : _d.call(_c, value, {
|
|
2232
|
+
_plasmic_state_init_: isInitOnChange,
|
|
2233
|
+
});
|
|
2229
2234
|
if (isInitOnChange) {
|
|
2230
2235
|
$$state.initializedLeafPaths.add(pathKey);
|
|
2231
2236
|
}
|
|
@@ -2502,11 +2507,10 @@ function useDollarState(specs) {
|
|
|
2502
2507
|
useIsomorphicLayoutEffect(function () {
|
|
2503
2508
|
$$state.specTreeLeaves.forEach(function (node) {
|
|
2504
2509
|
var spec = node.getSpec();
|
|
2505
|
-
if (!spec.isRepeated && spec.type !== "private"
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
}
|
|
2510
|
+
if (!spec.isRepeated && spec.type !== "private") {
|
|
2511
|
+
// We only need to attempt to access the state cell to trigger initialization,
|
|
2512
|
+
// Check create$StateProxy for more details on how this works.
|
|
2513
|
+
getStateCellFrom$StateRoot($state, spec.pathObj);
|
|
2510
2514
|
}
|
|
2511
2515
|
});
|
|
2512
2516
|
}, []);
|