Skip to content

Commit

Permalink
useCallback implemented for onSearch
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffibm committed May 8, 2024
1 parent f7cdc41 commit 4f76227
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useMemo } from 'react';
import React, { useState, useMemo, useCallback } from 'react';
import PropTypes from 'prop-types';
import { useQuery } from 'react-query';
import { Loading } from 'carbon-components-react';
Expand Down Expand Up @@ -52,7 +52,10 @@ const NamespaceSelector = ({ onSelectMethod, selectedIds }) => {
}, 300);

/** Function to handle the onSearch event during a filter change event. */
const onSearch = (newFilterData) => debouncedSearch(newFilterData);
const onSearch = useCallback(
(newFilterData) => debouncedSearch(newFilterData),
[debouncedSearch]
);

/** Function to handle the click event of a cell in the data table. */
const onCellClick = (selectedRow, cellType, checked) => {
Expand Down

0 comments on commit 4f76227

Please sign in to comment.