@plasmicapp/react-web 0.2.358 → 0.2.359

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,15 @@ 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, isInitOnChange);
2229
+ if (isInitOnChange) {
2230
+ $$state.initializedLeafPaths.add(pathKey);
2231
+ }
2224
2232
  }
2225
2233
  }
2226
2234
  if (!nextNode) {
@@ -2345,6 +2353,7 @@ function useDollarState(specs) {
2345
2353
  specs: [],
2346
2354
  registrationsQueue: [],
2347
2355
  stateInitializationEnv: { stack: [], visited: new Set() },
2356
+ initializedLeafPaths: new Set(),
2348
2357
  };
2349
2358
  })()).current;
2350
2359
  $$state.env = envFieldsAreNonNill(env);