@plasmicapp/react-web 0.2.358 → 0.2.360

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.
@@ -2220,7 +2220,17 @@ function create$StateProxy($$state, leafHandlers) {
2220
2220
  (_b = (_a = leafHandlers(ensureStateCell(receiver, property, nextPath, nextNode))).set) === null || _b === void 0 ? void 0 : _b.call(_a, target, property, value, receiver);
2221
2221
  Reflect.set(target, property, value, receiver);
2222
2222
  if (nextSpec === null || nextSpec === void 0 ? void 0 : nextSpec.onChangeProp) {
2223
- (_d = (_c = $$state.env.$props)[nextSpec.onChangeProp]) === null || _d === void 0 ? void 0 : _d.call(_c, value);
2223
+ var pathKey = JSON.stringify(nextPath);
2224
+ var isInitOnChange = !$$state.initializedLeafPaths.has(pathKey);
2225
+ // 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
2227
+ // 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, {
2229
+ _plasmic_state_init_: isInitOnChange,
2230
+ });
2231
+ if (isInitOnChange) {
2232
+ $$state.initializedLeafPaths.add(pathKey);
2233
+ }
2224
2234
  }
2225
2235
  }
2226
2236
  if (!nextNode) {
@@ -2345,6 +2355,7 @@ function useDollarState(specs) {
2345
2355
  specs: [],
2346
2356
  registrationsQueue: [],
2347
2357
  stateInitializationEnv: { stack: [], visited: new Set() },
2358
+ initializedLeafPaths: new Set(),
2348
2359
  };
2349
2360
  })()).current;
2350
2361
  $$state.env = envFieldsAreNonNill(env);