@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.
package/dist/index.cjs.js CHANGED
@@ -2239,7 +2239,15 @@ function create$StateProxy($$state, leafHandlers) {
2239
2239
  (_b = (_a = leafHandlers(ensureStateCell(receiver, property, nextPath, nextNode))).set) === null || _b === void 0 ? void 0 : _b.call(_a, target, property, value, receiver);
2240
2240
  Reflect.set(target, property, value, receiver);
2241
2241
  if (nextSpec === null || nextSpec === void 0 ? void 0 : nextSpec.onChangeProp) {
2242
- (_d = (_c = $$state.env.$props)[nextSpec.onChangeProp]) === null || _d === void 0 ? void 0 : _d.call(_c, value);
2242
+ var pathKey = JSON.stringify(nextPath);
2243
+ var isInitOnChange = !$$state.initializedLeafPaths.has(pathKey);
2244
+ // 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
2246
+ // to the onChangeProp function to indicate that the call is made during initialization.
2247
+ (_d = (_c = $$state.env.$props)[nextSpec.onChangeProp]) === null || _d === void 0 ? void 0 : _d.call(_c, value, isInitOnChange);
2248
+ if (isInitOnChange) {
2249
+ $$state.initializedLeafPaths.add(pathKey);
2250
+ }
2243
2251
  }
2244
2252
  }
2245
2253
  if (!nextNode) {
@@ -2364,6 +2372,7 @@ function useDollarState(specs) {
2364
2372
  specs: [],
2365
2373
  registrationsQueue: [],
2366
2374
  stateInitializationEnv: { stack: [], visited: new Set() },
2375
+ initializedLeafPaths: new Set(),
2367
2376
  };
2368
2377
  })()).current;
2369
2378
  $$state.env = envFieldsAreNonNill(env);