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