@carbon/ibm-products 2.54.0-canary.67 → 2.54.0-canary.68

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.
@@ -72,8 +72,7 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
72
72
  }, [actionState]);
73
73
  useEffect(function () {
74
74
  if (initialState !== null && initialState !== void 0 && initialState.enabledDefault) {
75
- setRootState === null || setRootState === void 0 || setRootState(initialConditionState.current);
76
- initialConditionState.current = null;
75
+ setRootState === null || setRootState === void 0 || setRootState(initialState.state);
77
76
  }
78
77
  // eslint-disable-next-line react-hooks/exhaustive-deps
79
78
  }, [initialState]);
@@ -92,11 +91,16 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
92
91
  };
93
92
  var _onRemove = useCallback(function (groupId) {
94
93
  var _rootState$groups2;
94
+ var groups = rootState === null || rootState === void 0 || (_rootState$groups2 = rootState.groups) === null || _rootState$groups2 === void 0 ? void 0 : _rootState$groups2.filter(function (group) {
95
+ return groupId !== (group === null || group === void 0 ? void 0 : group.id);
96
+ });
95
97
  setRootState === null || setRootState === void 0 || setRootState(_objectSpread2(_objectSpread2({}, rootState), {}, {
96
- groups: rootState ? rootState === null || rootState === void 0 || (_rootState$groups2 = rootState.groups) === null || _rootState$groups2 === void 0 ? void 0 : _rootState$groups2.filter(function (group) {
97
- return groupId !== (group === null || group === void 0 ? void 0 : group.id);
98
- }) : []
98
+ groups: rootState ? groups : []
99
99
  }));
100
+ //set the initial state to empty.
101
+ if ((groups === null || groups === void 0 ? void 0 : groups.length) === 0) {
102
+ initialConditionState.current = null;
103
+ }
100
104
  }, [setRootState, rootState]);
101
105
  var onChangeHandler = function onChangeHandler(updatedGroup, groupIndex) {
102
106
  /**
@@ -76,8 +76,7 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
76
76
  }, [actionState]);
77
77
  React.useEffect(function () {
78
78
  if (initialState !== null && initialState !== void 0 && initialState.enabledDefault) {
79
- setRootState === null || setRootState === void 0 || setRootState(initialConditionState.current);
80
- initialConditionState.current = null;
79
+ setRootState === null || setRootState === void 0 || setRootState(initialState.state);
81
80
  }
82
81
  // eslint-disable-next-line react-hooks/exhaustive-deps
83
82
  }, [initialState]);
@@ -96,11 +95,16 @@ var ConditionBuilderContent = function ConditionBuilderContent(_ref) {
96
95
  };
97
96
  var _onRemove = React.useCallback(function (groupId) {
98
97
  var _rootState$groups2;
98
+ var groups = rootState === null || rootState === void 0 || (_rootState$groups2 = rootState.groups) === null || _rootState$groups2 === void 0 ? void 0 : _rootState$groups2.filter(function (group) {
99
+ return groupId !== (group === null || group === void 0 ? void 0 : group.id);
100
+ });
99
101
  setRootState === null || setRootState === void 0 || setRootState(_rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, rootState), {}, {
100
- groups: rootState ? rootState === null || rootState === void 0 || (_rootState$groups2 = rootState.groups) === null || _rootState$groups2 === void 0 ? void 0 : _rootState$groups2.filter(function (group) {
101
- return groupId !== (group === null || group === void 0 ? void 0 : group.id);
102
- }) : []
102
+ groups: rootState ? groups : []
103
103
  }));
104
+ //set the initial state to empty.
105
+ if ((groups === null || groups === void 0 ? void 0 : groups.length) === 0) {
106
+ initialConditionState.current = null;
107
+ }
104
108
  }, [setRootState, rootState]);
105
109
  var onChangeHandler = function onChangeHandler(updatedGroup, groupIndex) {
106
110
  /**
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ibm-products",
3
3
  "description": "Carbon for IBM Products",
4
- "version": "2.54.0-canary.67+c6f0ac0f4",
4
+ "version": "2.54.0-canary.68+ea0989ae2",
5
5
  "license": "Apache-2.0",
6
6
  "main": "lib/index.js",
7
7
  "module": "es/index.js",
@@ -120,5 +120,5 @@
120
120
  "react": "^16.8.6 || ^17.0.1 || ^18.2.0",
121
121
  "react-dom": "^16.8.6 || ^17.0.1 || ^18.2.0"
122
122
  },
123
- "gitHead": "c6f0ac0f444165b55e37873c80462401fd34f14f"
123
+ "gitHead": "ea0989ae23b6a23450491c4994bf4e46687dbeb2"
124
124
  }