@bpmn-io/form-js-viewer 2.0.0-alpha.0 → 2.0.2

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.
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Ids } from 'ids';
2
- import { isString, get, isNil, isObject, some, isNumber, set, isDefined, findIndex, isArray, values, uniqueBy, isFunction, bind, assign, groupBy, isUndefined } from 'min-dash';
2
+ import { isString, get, isNil, isObject, some, merge, isNumber, set, isDefined, findIndex, isArray, values, uniqueBy, isFunction, bind, assign, groupBy, isUndefined } from 'min-dash';
3
3
  import Big from 'big.js';
4
4
  import classNames from 'classnames';
5
5
  import { jsx, jsxs, Fragment } from 'preact/jsx-runtime';
@@ -1408,10 +1408,11 @@ function useFilteredFormData() {
1408
1408
  const conditionChecker = useService('conditionChecker', false);
1409
1409
  return useMemo(() => {
1410
1410
  const newData = conditionChecker ? conditionChecker.applyConditions(data, data) : data;
1411
- return {
1412
- ...initialData,
1413
- ...newData
1414
- };
1411
+
1412
+ // deep-merge newData over a clone of initialData, so keys pruned from
1413
+ // newData (e.g. by a hidden group) fall back to their initial value
1414
+ // instead of the whole branch disappearing
1415
+ return merge(clone(initialData || {}), newData);
1415
1416
  }, [conditionChecker, data, initialData]);
1416
1417
  }
1417
1418