@plasmicapp/react-web 0.2.360 → 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 CHANGED
@@ -2240,9 +2240,12 @@ 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 = !$$state.initializedLeafPaths.has(pathKey);
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 addtionnal parameter
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
2250
  (_d = (_c = $$state.env.$props)[nextSpec.onChangeProp]) === null || _d === void 0 ? void 0 : _d.call(_c, value, {
2248
2251
  _plasmic_state_init_: isInitOnChange,
@@ -2523,11 +2526,10 @@ function useDollarState(specs) {
2523
2526
  useIsomorphicLayoutEffect(function () {
2524
2527
  $$state.specTreeLeaves.forEach(function (node) {
2525
2528
  var spec = node.getSpec();
2526
- if (!spec.isRepeated && spec.type !== "private" && spec.initFunc) {
2527
- var stateCell = getStateCellFrom$StateRoot($state, spec.pathObj);
2528
- if (stateCell.initialValue === UNINITIALIZED) {
2529
- initializeStateValue($$state, stateCell, $state);
2530
- }
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);
2531
2533
  }
2532
2534
  });
2533
2535
  }, []);