react-instantsearch-core 6.36.0 → 6.37.0

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.
@@ -81,6 +81,7 @@ function createConnectorWithoutContext(connectorDesc) {
81
81
  _this = _super.call(this, props);
82
82
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unsubscribe", void 0);
83
83
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "unregisterWidget", void 0);
84
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "cleanupTimerRef", null);
84
85
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isUnmounting", false);
85
86
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "state", {
86
87
  providedProps: _this.getProvidedProps(_this.props)
@@ -131,6 +132,11 @@ function createConnectorWithoutContext(connectorDesc) {
131
132
  value: function componentDidMount() {
132
133
  var _this2 = this;
133
134
 
135
+ if (this.cleanupTimerRef) {
136
+ clearTimeout(this.cleanupTimerRef);
137
+ this.cleanupTimerRef = null;
138
+ }
139
+
134
140
  this.unsubscribe = this.props.contextValue.store.subscribe(function () {
135
141
  if (!_this2.isUnmounting) {
136
142
  _this2.setState({
@@ -182,23 +188,29 @@ function createConnectorWithoutContext(connectorDesc) {
182
188
  }, {
183
189
  key: "componentWillUnmount",
184
190
  value: function componentWillUnmount() {
185
- this.isUnmounting = true;
191
+ var _this3 = this;
186
192
 
187
- if (this.unsubscribe) {
188
- this.unsubscribe();
189
- }
193
+ this.cleanupTimerRef = setTimeout(function () {
194
+ _this3.isUnmounting = true;
195
+
196
+ if (_this3.unsubscribe) {
197
+ _this3.unsubscribe();
198
+ }
190
199
 
191
- if (this.unregisterWidget) {
192
- this.unregisterWidget();
200
+ if (_this3.unregisterWidget) {
201
+ _this3.unregisterWidget();
193
202
 
194
- if (typeof connectorDesc.cleanUp === 'function') {
195
- var nextState = connectorDesc.cleanUp.call(this, this.props, this.props.contextValue.store.getState().widgets);
196
- this.props.contextValue.store.setState(_objectSpread(_objectSpread({}, this.props.contextValue.store.getState()), {}, {
197
- widgets: nextState
198
- }));
199
- this.props.contextValue.onSearchStateChange((0, _utils.removeEmptyKey)(nextState));
203
+ if (typeof connectorDesc.cleanUp === 'function') {
204
+ var nextState = connectorDesc.cleanUp.call(_this3, _this3.props, _this3.props.contextValue.store.getState().widgets);
205
+
206
+ _this3.props.contextValue.store.setState(_objectSpread(_objectSpread({}, _this3.props.contextValue.store.getState()), {}, {
207
+ widgets: nextState
208
+ }));
209
+
210
+ _this3.props.contextValue.onSearchStateChange((0, _utils.removeEmptyKey)(nextState));
211
+ }
200
212
  }
201
- }
213
+ });
202
214
  }
203
215
  }, {
204
216
  key: "getProvidedProps",
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
- var _default = '6.36.0';
7
+ var _default = '6.37.0';
8
8
  exports.default = _default;
@@ -100,6 +100,7 @@ var InstantSearch = /*#__PURE__*/function (_Component) {
100
100
 
101
101
  (0, _classCallCheck2.default)(this, InstantSearch);
102
102
  _this = _super.call(this, props);
103
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "cleanupTimerRef", null);
103
104
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isUnmounting", false);
104
105
  var instantSearchManager = (0, _createInstantSearchManager.default)({
105
106
  indexName: _this.props.indexName,
@@ -154,6 +155,11 @@ var InstantSearch = /*#__PURE__*/function (_Component) {
154
155
  }, {
155
156
  key: "componentDidMount",
156
157
  value: function componentDidMount() {
158
+ if (this.cleanupTimerRef) {
159
+ clearTimeout(this.cleanupTimerRef);
160
+ this.cleanupTimerRef = null;
161
+ }
162
+
157
163
  if ((0, _metadata.isMetadataEnabled)()) {
158
164
  (0, _metadata.injectMetadata)(this.state.instantSearchManager.widgetsManager.getWidgets(), this.props.searchClient);
159
165
  }
@@ -161,8 +167,13 @@ var InstantSearch = /*#__PURE__*/function (_Component) {
161
167
  }, {
162
168
  key: "componentWillUnmount",
163
169
  value: function componentWillUnmount() {
164
- this.isUnmounting = true;
165
- this.state.instantSearchManager.skipSearch();
170
+ var _this2 = this;
171
+
172
+ this.cleanupTimerRef = setTimeout(function () {
173
+ _this2.isUnmounting = true;
174
+
175
+ _this2.state.instantSearchManager.skipSearch();
176
+ });
166
177
  }
167
178
  }, {
168
179
  key: "createHrefForState",
@@ -57,6 +57,8 @@ export function createConnectorWithoutContext(connectorDesc) {
57
57
 
58
58
  _defineProperty(_assertThisInitialized(_this), "unregisterWidget", void 0);
59
59
 
60
+ _defineProperty(_assertThisInitialized(_this), "cleanupTimerRef", null);
61
+
60
62
  _defineProperty(_assertThisInitialized(_this), "isUnmounting", false);
61
63
 
62
64
  _defineProperty(_assertThisInitialized(_this), "state", {
@@ -111,6 +113,11 @@ export function createConnectorWithoutContext(connectorDesc) {
111
113
  value: function componentDidMount() {
112
114
  var _this2 = this;
113
115
 
116
+ if (this.cleanupTimerRef) {
117
+ clearTimeout(this.cleanupTimerRef);
118
+ this.cleanupTimerRef = null;
119
+ }
120
+
114
121
  this.unsubscribe = this.props.contextValue.store.subscribe(function () {
115
122
  if (!_this2.isUnmounting) {
116
123
  _this2.setState({
@@ -162,23 +169,29 @@ export function createConnectorWithoutContext(connectorDesc) {
162
169
  }, {
163
170
  key: "componentWillUnmount",
164
171
  value: function componentWillUnmount() {
165
- this.isUnmounting = true;
172
+ var _this3 = this;
166
173
 
167
- if (this.unsubscribe) {
168
- this.unsubscribe();
169
- }
174
+ this.cleanupTimerRef = setTimeout(function () {
175
+ _this3.isUnmounting = true;
176
+
177
+ if (_this3.unsubscribe) {
178
+ _this3.unsubscribe();
179
+ }
170
180
 
171
- if (this.unregisterWidget) {
172
- this.unregisterWidget();
181
+ if (_this3.unregisterWidget) {
182
+ _this3.unregisterWidget();
173
183
 
174
- if (typeof connectorDesc.cleanUp === 'function') {
175
- var nextState = connectorDesc.cleanUp.call(this, this.props, this.props.contextValue.store.getState().widgets);
176
- this.props.contextValue.store.setState(_objectSpread(_objectSpread({}, this.props.contextValue.store.getState()), {}, {
177
- widgets: nextState
178
- }));
179
- this.props.contextValue.onSearchStateChange(removeEmptyKey(nextState));
184
+ if (typeof connectorDesc.cleanUp === 'function') {
185
+ var nextState = connectorDesc.cleanUp.call(_this3, _this3.props, _this3.props.contextValue.store.getState().widgets);
186
+
187
+ _this3.props.contextValue.store.setState(_objectSpread(_objectSpread({}, _this3.props.contextValue.store.getState()), {}, {
188
+ widgets: nextState
189
+ }));
190
+
191
+ _this3.props.contextValue.onSearchStateChange(removeEmptyKey(nextState));
192
+ }
180
193
  }
181
- }
194
+ });
182
195
  }
183
196
  }, {
184
197
  key: "getProvidedProps",
@@ -1 +1 @@
1
- export default '6.36.0';
1
+ export default '6.37.0';
@@ -76,6 +76,8 @@ var InstantSearch = /*#__PURE__*/function (_Component) {
76
76
 
77
77
  _this = _super.call(this, props);
78
78
 
79
+ _defineProperty(_assertThisInitialized(_this), "cleanupTimerRef", null);
80
+
79
81
  _defineProperty(_assertThisInitialized(_this), "isUnmounting", false);
80
82
 
81
83
  var instantSearchManager = createInstantSearchManager({
@@ -131,6 +133,11 @@ var InstantSearch = /*#__PURE__*/function (_Component) {
131
133
  }, {
132
134
  key: "componentDidMount",
133
135
  value: function componentDidMount() {
136
+ if (this.cleanupTimerRef) {
137
+ clearTimeout(this.cleanupTimerRef);
138
+ this.cleanupTimerRef = null;
139
+ }
140
+
134
141
  if (isMetadataEnabled()) {
135
142
  injectMetadata(this.state.instantSearchManager.widgetsManager.getWidgets(), this.props.searchClient);
136
143
  }
@@ -138,8 +145,13 @@ var InstantSearch = /*#__PURE__*/function (_Component) {
138
145
  }, {
139
146
  key: "componentWillUnmount",
140
147
  value: function componentWillUnmount() {
141
- this.isUnmounting = true;
142
- this.state.instantSearchManager.skipSearch();
148
+ var _this2 = this;
149
+
150
+ this.cleanupTimerRef = setTimeout(function () {
151
+ _this2.isUnmounting = true;
152
+
153
+ _this2.state.instantSearchManager.skipSearch();
154
+ });
143
155
  }
144
156
  }, {
145
157
  key: "createHrefForState",
@@ -1,4 +1,4 @@
1
- /*! React InstantSearchCore 6.36.0 | © Algolia, inc. | https://github.com/algolia/react-instantsearch */
1
+ /*! React InstantSearchCore 6.37.0 | © Algolia, inc. | https://github.com/algolia/react-instantsearch */
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', 'react'], factory) :
@@ -513,6 +513,8 @@
513
513
 
514
514
  _defineProperty(_assertThisInitialized(_this), "unregisterWidget", void 0);
515
515
 
516
+ _defineProperty(_assertThisInitialized(_this), "cleanupTimerRef", null);
517
+
516
518
  _defineProperty(_assertThisInitialized(_this), "isUnmounting", false);
517
519
 
518
520
  _defineProperty(_assertThisInitialized(_this), "state", {
@@ -567,6 +569,11 @@
567
569
  value: function componentDidMount() {
568
570
  var _this2 = this;
569
571
 
572
+ if (this.cleanupTimerRef) {
573
+ clearTimeout(this.cleanupTimerRef);
574
+ this.cleanupTimerRef = null;
575
+ }
576
+
570
577
  this.unsubscribe = this.props.contextValue.store.subscribe(function () {
571
578
  if (!_this2.isUnmounting) {
572
579
  _this2.setState({
@@ -618,23 +625,29 @@
618
625
  }, {
619
626
  key: "componentWillUnmount",
620
627
  value: function componentWillUnmount() {
621
- this.isUnmounting = true;
628
+ var _this3 = this;
622
629
 
623
- if (this.unsubscribe) {
624
- this.unsubscribe();
625
- }
630
+ this.cleanupTimerRef = setTimeout(function () {
631
+ _this3.isUnmounting = true;
626
632
 
627
- if (this.unregisterWidget) {
628
- this.unregisterWidget();
633
+ if (_this3.unsubscribe) {
634
+ _this3.unsubscribe();
635
+ }
629
636
 
630
- if (typeof connectorDesc.cleanUp === 'function') {
631
- var nextState = connectorDesc.cleanUp.call(this, this.props, this.props.contextValue.store.getState().widgets);
632
- this.props.contextValue.store.setState(_objectSpread$1(_objectSpread$1({}, this.props.contextValue.store.getState()), {}, {
633
- widgets: nextState
634
- }));
635
- this.props.contextValue.onSearchStateChange(removeEmptyKey(nextState));
637
+ if (_this3.unregisterWidget) {
638
+ _this3.unregisterWidget();
639
+
640
+ if (typeof connectorDesc.cleanUp === 'function') {
641
+ var nextState = connectorDesc.cleanUp.call(_this3, _this3.props, _this3.props.contextValue.store.getState().widgets);
642
+
643
+ _this3.props.contextValue.store.setState(_objectSpread$1(_objectSpread$1({}, _this3.props.contextValue.store.getState()), {}, {
644
+ widgets: nextState
645
+ }));
646
+
647
+ _this3.props.contextValue.onSearchStateChange(removeEmptyKey(nextState));
648
+ }
636
649
  }
637
- }
650
+ });
638
651
  }
639
652
  }, {
640
653
  key: "getProvidedProps",
@@ -848,7 +861,7 @@
848
861
  });
849
862
  }
850
863
 
851
- var version = '6.36.0';
864
+ var version = '6.37.0';
852
865
 
853
866
  function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
854
867
 
@@ -8184,6 +8197,8 @@
8184
8197
 
8185
8198
  _this = _super.call(this, props);
8186
8199
 
8200
+ _defineProperty(_assertThisInitialized(_this), "cleanupTimerRef", null);
8201
+
8187
8202
  _defineProperty(_assertThisInitialized(_this), "isUnmounting", false);
8188
8203
 
8189
8204
  var instantSearchManager = createInstantSearchManager({
@@ -8239,6 +8254,11 @@
8239
8254
  }, {
8240
8255
  key: "componentDidMount",
8241
8256
  value: function componentDidMount() {
8257
+ if (this.cleanupTimerRef) {
8258
+ clearTimeout(this.cleanupTimerRef);
8259
+ this.cleanupTimerRef = null;
8260
+ }
8261
+
8242
8262
  if (isMetadataEnabled()) {
8243
8263
  injectMetadata(this.state.instantSearchManager.widgetsManager.getWidgets(), this.props.searchClient);
8244
8264
  }
@@ -8246,8 +8266,13 @@
8246
8266
  }, {
8247
8267
  key: "componentWillUnmount",
8248
8268
  value: function componentWillUnmount() {
8249
- this.isUnmounting = true;
8250
- this.state.instantSearchManager.skipSearch();
8269
+ var _this2 = this;
8270
+
8271
+ this.cleanupTimerRef = setTimeout(function () {
8272
+ _this2.isUnmounting = true;
8273
+
8274
+ _this2.state.instantSearchManager.skipSearch();
8275
+ });
8251
8276
  }
8252
8277
  }, {
8253
8278
  key: "createHrefForState",