@plasmicapp/react-web 0.2.181 → 0.2.183

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.
@@ -2887,11 +2887,13 @@ function useDollarState(specs) {
2887
2887
  var old$state = $state;
2888
2888
  $state = ref.current = create$State();
2889
2889
  $$state.specTreeLeaves = newLeaves;
2890
- getStateCells(newLeaves, $$state.rootSpecTree).forEach(function (_ref2) {
2890
+ getStateCells(old$state, $$state.rootSpecTree).forEach(function (_ref2) {
2891
2891
  var path = _ref2.path;
2892
2892
  var oldStateCell = tryGetStateCellFrom$StateRoot(old$state, path);
2893
2893
  if (oldStateCell) {
2894
2894
  set($state, path, _get(old$state, path));
2895
+ var newStateCell = getStateCellFrom$StateRoot($state, path);
2896
+ newStateCell.initialValue = oldStateCell.initialValue;
2895
2897
  }
2896
2898
  });
2897
2899
  }
@@ -2906,7 +2908,7 @@ function useDollarState(specs) {
2906
2908
  var newSpec = specs.find(function (sp) {
2907
2909
  return sp.path === spec.path;
2908
2910
  });
2909
- if (!newSpec || stateCell.initFuncHash === (newSpec == null ? void 0 : newSpec.initFuncHash)) {
2911
+ if (!newSpec || stateCell.initFuncHash === (newSpec == null ? void 0 : newSpec.initFuncHash) || stateCell.initialValue !== UNINITIALIZED) {
2910
2912
  return;
2911
2913
  }
2912
2914
  stateCell.initFunc = newSpec.initFunc;
@@ -3032,29 +3034,29 @@ function isPlasmicStateProxy(obj) {
3032
3034
  return obj != null && typeof obj === "object" && !!obj[PLASMIC_STATE_PROXY_SYMBOL];
3033
3035
  }
3034
3036
  function getStateCells($state, root) {
3035
- var _proxyObjToStateCell$;
3036
3037
  if ($state == null || typeof $state !== "object") {
3037
3038
  return [];
3038
3039
  }
3039
- var stateCells = Object.values((_proxyObjToStateCell$ = proxyObjToStateCell.get($state)) != null ? _proxyObjToStateCell$ : {});
3040
- if (root.isLeaf()) {
3041
- return stateCells;
3042
- }
3043
3040
  if (root.hasArrayTransition()) {
3044
- return [].concat(stateCells, Object.keys($state).flatMap(function (key) {
3041
+ return Object.keys($state).flatMap(function (key) {
3045
3042
  return getStateCells($state[key], ensure(root.makeTransition(ARRAY_SYMBOL)));
3046
- }));
3043
+ });
3047
3044
  } else {
3048
- var childrenStateCells = [];
3045
+ var _proxyObjToStateCell$;
3046
+ var stateCell = (_proxyObjToStateCell$ = proxyObjToStateCell.get($state)) != null ? _proxyObjToStateCell$ : {};
3047
+ var stateCells = [];
3049
3048
  for (var _iterator3 = _createForOfIteratorHelperLoose(root.edges().entries()), _step3; !(_step3 = _iterator3()).done;) {
3050
3049
  var _step3$value = _step3.value,
3051
3050
  key = _step3$value[0],
3052
3051
  child = _step3$value[1];
3053
3052
  if (typeof key === "string" && key in $state) {
3054
- childrenStateCells.push.apply(childrenStateCells, getStateCells($state[key], child));
3053
+ stateCells.push.apply(stateCells, getStateCells($state[key], child));
3054
+ if (key in stateCell) {
3055
+ stateCells.push(stateCell[key]);
3056
+ }
3055
3057
  }
3056
3058
  }
3057
- return [].concat(stateCells, childrenStateCells);
3059
+ return stateCells;
3058
3060
  }
3059
3061
  }
3060
3062
  function getStateCellsInPlasmicProxy(obj) {