@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.
@@ -66,4 +66,5 @@ export interface Internal$State {
66
66
  stack: string[];
67
67
  visited: Set<string>;
68
68
  };
69
+ initializedLeafPaths: Set<string>;
69
70
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicapp/react-web",
3
- "version": "0.2.358",
3
+ "version": "0.2.359",
4
4
  "description": "plasmic library for rendering in the presentational style",
5
5
  "main": "dist/index.cjs.js",
6
6
  "types": "dist/index.d.ts",
@@ -168,5 +168,5 @@
168
168
  "react": ">=16.8.0",
169
169
  "react-dom": ">=16.8.0"
170
170
  },
171
- "gitHead": "90562f44f158b15245f72926fd82658a41d0bba2"
171
+ "gitHead": "53a85fd08ce84bfb2ed052a7ed9a662ad15bf8e8"
172
172
  }
@@ -1146,7 +1146,15 @@ function create$StateProxy($$state, leafHandlers) {
1146
1146
  (_b = (_a = leafHandlers(ensureStateCell(receiver, property, nextPath, nextNode))).set) === null || _b === void 0 ? void 0 : _b.call(_a, target, property, value, receiver);
1147
1147
  Reflect.set(target, property, value, receiver);
1148
1148
  if (nextSpec === null || nextSpec === void 0 ? void 0 : nextSpec.onChangeProp) {
1149
- (_d = (_c = $$state.env.$props)[nextSpec.onChangeProp]) === null || _d === void 0 ? void 0 : _d.call(_c, value);
1149
+ var pathKey = JSON.stringify(nextPath);
1150
+ var isInitOnChange = !$$state.initializedLeafPaths.has(pathKey);
1151
+ // We need to call the onChangeProp during initialization process so that the parent
1152
+ // state can be updated with the correct value. We will provide an addtionnal parameter
1153
+ // to the onChangeProp function to indicate that the call is made during initialization.
1154
+ (_d = (_c = $$state.env.$props)[nextSpec.onChangeProp]) === null || _d === void 0 ? void 0 : _d.call(_c, value, isInitOnChange);
1155
+ if (isInitOnChange) {
1156
+ $$state.initializedLeafPaths.add(pathKey);
1157
+ }
1150
1158
  }
1151
1159
  }
1152
1160
  if (!nextNode) {
@@ -1271,6 +1279,7 @@ function useDollarState(specs) {
1271
1279
  specs: [],
1272
1280
  registrationsQueue: [],
1273
1281
  stateInitializationEnv: { stack: [], visited: new Set() },
1282
+ initializedLeafPaths: new Set(),
1274
1283
  };
1275
1284
  })()).current;
1276
1285
  $$state.env = envFieldsAreNonNill(env);