@bento-core/facet-filter 1.0.1-icdc.7 → 1.0.1-icdc.8

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.
@@ -51,11 +51,13 @@ const FacetView = _ref => {
51
51
  (0, _react.useEffect)(() => {
52
52
  if (enableFacetCollapse) {
53
53
  const actionType = currentActionType[datafield];
54
+ console.log(currentActionType);
54
55
  if (actionType && actionType === _ActionTypes.sideBarActionTypes.CLEAR_FACET_SECTION || currentActionType === _ActionTypes.sideBarActionTypes.CLEAR_ALL_FILTERS) {
56
+ console.log('set to false');
55
57
  setExpand(false);
56
58
  }
57
59
  }
58
- }, [currentActionType]);
60
+ }, [filterState]);
59
61
 
60
62
  /**
61
63
  * expand section incase of active local search
@@ -91,12 +91,14 @@ function sideBarReducerGenerator() {
91
91
  case _ActionTypes.sideBarActionTypes.FACET_VALUE_CHANGED:
92
92
  updateState = onToggleStateUpdate(_objectSpread(_objectSpread({}, state), payload));
93
93
  return _objectSpread(_objectSpread({}, state), {}, {
94
- filterState: _objectSpread({}, updateState)
94
+ filterState: _objectSpread({}, updateState),
95
+ currentActionType: _ActionTypes.sideBarActionTypes.FACET_VALUE_CHANGED
95
96
  });
96
97
  case _ActionTypes.sideBarActionTypes.ON_TOGGLE_SLIDER:
97
98
  updateState = updateSiderValue(_objectSpread(_objectSpread({}, state), payload));
98
99
  return _objectSpread(_objectSpread({}, state), {}, {
99
- filterState: _objectSpread({}, updateState)
100
+ filterState: _objectSpread({}, updateState),
101
+ currentActionType: _ActionTypes.sideBarActionTypes.ON_TOGGLE_SLIDER
100
102
  });
101
103
  case _ActionTypes.sideBarActionTypes.CLEAR_ALL_FILTERS:
102
104
  return _objectSpread(_objectSpread({}, state), {}, {
@@ -119,14 +121,14 @@ function sideBarReducerGenerator() {
119
121
  case _ActionTypes.sideBarActionTypes.CLEAR_SLIDER_SECTION:
120
122
  updateState = onClearSliderSection(_objectSpread(_objectSpread({}, payload), state));
121
123
  return _objectSpread(_objectSpread({}, state), {}, {
122
- filterState: _objectSpread({}, updateState)
124
+ filterState: _objectSpread({}, updateState),
125
+ currentActionType: _ActionTypes.sideBarActionTypes.CLEAR_SLIDER_SECTION
123
126
  });
124
127
  case _ActionTypes.sideBarActionTypes.CLEAR_AND_SELECT_FACET_VALUE:
125
128
  return {
126
- filterState: payload
129
+ filterState: payload,
130
+ currentActionType: _ActionTypes.sideBarActionTypes.CLEAR_AND_SELECT_FACET_VALUE
127
131
  };
128
- case _ActionTypes.sideBarActionTypes.CURR_FILTER_ACTION:
129
- return _objectSpread(_objectSpread({}, state), payload);
130
132
  default:
131
133
  return state;
132
134
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bento-core/facet-filter",
3
- "version": "1.0.1-icdc.7",
3
+ "version": "1.0.1-icdc.8",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -38,12 +38,14 @@ const FacetView = ({
38
38
  useEffect(() => {
39
39
  if (enableFacetCollapse) {
40
40
  const actionType = currentActionType[datafield];
41
+ console.log(currentActionType);
41
42
  if ((actionType && actionType === sideBarActionTypes.CLEAR_FACET_SECTION)
42
43
  || currentActionType === sideBarActionTypes.CLEAR_ALL_FILTERS) {
44
+ console.log('set to false');
43
45
  setExpand(false);
44
46
  }
45
47
  }
46
- }, [currentActionType]);
48
+ }, [filterState]);
47
49
 
48
50
  /**
49
51
  * expand section incase of active local search
@@ -67,12 +67,14 @@ export function sideBarReducerGenerator() {
67
67
  return {
68
68
  ...state,
69
69
  filterState: { ...updateState },
70
+ currentActionType: sideBarActionTypes.FACET_VALUE_CHANGED,
70
71
  };
71
72
  case sideBarActionTypes.ON_TOGGLE_SLIDER:
72
73
  updateState = updateSiderValue({ ...state, ...payload });
73
74
  return {
74
75
  ...state,
75
76
  filterState: { ...updateState },
77
+ currentActionType: sideBarActionTypes.ON_TOGGLE_SLIDER,
76
78
  };
77
79
  case sideBarActionTypes.CLEAR_ALL_FILTERS:
78
80
  return {
@@ -97,10 +99,12 @@ export function sideBarReducerGenerator() {
97
99
  return {
98
100
  ...state,
99
101
  filterState: { ...updateState },
102
+ currentActionType: sideBarActionTypes.CLEAR_SLIDER_SECTION,
100
103
  };
101
104
  case sideBarActionTypes.CLEAR_AND_SELECT_FACET_VALUE:
102
105
  return {
103
106
  filterState: payload,
107
+ currentActionType: sideBarActionTypes.CLEAR_AND_SELECT_FACET_VALUE,
104
108
  };
105
109
  default:
106
110
  return state;