@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.
@@ -2221,9 +2221,12 @@ 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 = !$$state.initializedLeafPaths.has(pathKey);
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 addtionnal parameter
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
2231
  (_d = (_c = $$state.env.$props)[nextSpec.onChangeProp]) === null || _d === void 0 ? void 0 : _d.call(_c, value, {
2229
2232
  _plasmic_state_init_: isInitOnChange,
@@ -2504,11 +2507,10 @@ function useDollarState(specs) {
2504
2507
  useIsomorphicLayoutEffect(function () {
2505
2508
  $$state.specTreeLeaves.forEach(function (node) {
2506
2509
  var spec = node.getSpec();
2507
- if (!spec.isRepeated && spec.type !== "private" && spec.initFunc) {
2508
- var stateCell = getStateCellFrom$StateRoot($state, spec.pathObj);
2509
- if (stateCell.initialValue === UNINITIALIZED) {
2510
- initializeStateValue($$state, stateCell, $state);
2511
- }
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);
2512
2514
  }
2513
2515
  });
2514
2516
  }, []);