@plasmicapp/react-web 0.2.359 → 0.2.361

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.
@@ -68,6 +68,7 @@ export declare const StateCellIsMatrix: import("@storybook/types").AnnotatedStor
68
68
  board: number[][];
69
69
  }>;
70
70
  export declare const IsOnChangePropImmediatelyFired: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, {}>;
71
+ export declare const IsOnChangeFiredWithCorrectInitialValue: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, {}>;
71
72
  export declare const ImmutableStateCells: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, {
72
73
  people: Person[];
73
74
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plasmicapp/react-web",
3
- "version": "0.2.359",
3
+ "version": "0.2.361",
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": "53a85fd08ce84bfb2ed052a7ed9a662ad15bf8e8"
171
+ "gitHead": "ca6c646bde3852007b61d28b61b27bcfa7388430"
172
172
  }
@@ -1147,11 +1147,16 @@ function create$StateProxy($$state, leafHandlers) {
1147
1147
  Reflect.set(target, property, value, receiver);
1148
1148
  if (nextSpec === null || nextSpec === void 0 ? void 0 : nextSpec.onChangeProp) {
1149
1149
  var pathKey = JSON.stringify(nextPath);
1150
- var isInitOnChange = !$$state.initializedLeafPaths.has(pathKey);
1150
+ var isInitOnChange =
1151
+ // If we are dealing with a valueProp it means that this state cell value is provided by the parent
1152
+ // and we don't need to consider initialization calls for it.
1153
+ !nextSpec.valueProp && !$$state.initializedLeafPaths.has(pathKey);
1151
1154
  // 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
1155
+ // state can be updated with the correct value. We will provide an additional parameter
1153
1156
  // 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);
1157
+ (_d = (_c = $$state.env.$props)[nextSpec.onChangeProp]) === null || _d === void 0 ? void 0 : _d.call(_c, value, {
1158
+ _plasmic_state_init_: isInitOnChange,
1159
+ });
1155
1160
  if (isInitOnChange) {
1156
1161
  $$state.initializedLeafPaths.add(pathKey);
1157
1162
  }
@@ -1428,11 +1433,10 @@ function useDollarState(specs) {
1428
1433
  useIsomorphicLayoutEffect(function () {
1429
1434
  $$state.specTreeLeaves.forEach(function (node) {
1430
1435
  var spec = node.getSpec();
1431
- if (!spec.isRepeated && spec.type !== "private" && spec.initFunc) {
1432
- var stateCell = getStateCellFrom$StateRoot($state, spec.pathObj);
1433
- if (stateCell.initialValue === UNINITIALIZED) {
1434
- initializeStateValue($$state, stateCell, $state);
1435
- }
1436
+ if (!spec.isRepeated && spec.type !== "private") {
1437
+ // We only need to attempt to access the state cell to trigger initialization,
1438
+ // Check create$StateProxy for more details on how this works.
1439
+ getStateCellFrom$StateRoot($state, spec.pathObj);
1436
1440
  }
1437
1441
  });
1438
1442
  }, []);