rsuite 5.37.2 → 5.37.3

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.
@@ -1,5 +1,5 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
- import React, { useState, useImperativeHandle, useCallback } from 'react';
2
+ import React, { useState, useImperativeHandle, useCallback, useMemo } from 'react';
3
3
  import kebabCase from 'lodash/kebabCase';
4
4
  import trim from 'lodash/trim';
5
5
  import isFunction from 'lodash/isFunction';
@@ -522,24 +522,17 @@ export function useSearch(data, props) {
522
522
  }
523
523
 
524
524
  return shouldDisplay(checkValue, _keyword);
525
- }, [labelKey, searchBy, searchKeyword]); // TODO-Doma
526
- // filteredData should be derived from data and searchKeyword
527
- // This redundant state might be here for preventing callback firing multiple times
528
- // Find out if this is the case and remove this state if possible
529
-
530
- var _useState5 = useState(function () {
525
+ }, [labelKey, searchBy, searchKeyword]);
526
+ var filteredData = useMemo(function () {
531
527
  return data.filter(function (item) {
532
- return checkShouldDisplay(item);
528
+ return checkShouldDisplay(item, searchKeyword);
533
529
  });
534
- }),
535
- filteredData = _useState5[0],
536
- setFilteredData = _useState5[1];
530
+ }, [checkShouldDisplay, data, searchKeyword]);
537
531
 
538
532
  var handleSearch = function handleSearch(searchKeyword, event) {
539
533
  var filteredData = data.filter(function (item) {
540
534
  return checkShouldDisplay(item, searchKeyword);
541
535
  });
542
- setFilteredData(filteredData);
543
536
  setSearchKeyword(searchKeyword);
544
537
  callback === null || callback === void 0 ? void 0 : callback(searchKeyword, filteredData, event);
545
538
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rsuite",
3
- "version": "5.37.2",
3
+ "version": "5.37.3",
4
4
  "description": "A suite of react components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",