@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.
@@ -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.360",
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": "16f19a3d4445fc28f1021baa2985dab3d3053abe"
172
172
  }
@@ -1146,7 +1146,17 @@ 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, {
1155
+ _plasmic_state_init_: isInitOnChange,
1156
+ });
1157
+ if (isInitOnChange) {
1158
+ $$state.initializedLeafPaths.add(pathKey);
1159
+ }
1150
1160
  }
1151
1161
  }
1152
1162
  if (!nextNode) {
@@ -1271,6 +1281,7 @@ function useDollarState(specs) {
1271
1281
  specs: [],
1272
1282
  registrationsQueue: [],
1273
1283
  stateInitializationEnv: { stack: [], visited: new Set() },
1284
+ initializedLeafPaths: new Set(),
1274
1285
  };
1275
1286
  })()).current;
1276
1287
  $$state.env = envFieldsAreNonNill(env);