Skip to content

Commit

Permalink
Merge pull request #892 from amitamrutiya/fix-share
Browse files Browse the repository at this point in the history
fix: share is not working issue
  • Loading branch information
amitamrutiya authored Jan 18, 2025
2 parents 0320125 + 283c3e1 commit 6209c54
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/custom/UserSearchField/UserSearchField.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Autocomplete from '@mui/material/Autocomplete';
import CircularProgress from '@mui/material/CircularProgress';
import { debounce } from 'lodash';
import React, { useState } from 'react';
import { Avatar, Box, Chip, Grid, TextField, Tooltip, Typography } from '../../base';
import { iconSmall } from '../../constants/iconsSizes';
Expand Down Expand Up @@ -88,21 +89,22 @@ const UserShareSearch: React.FC<UserSearchFieldProps> = ({
}
};

const handleInputChange = (_event: React.SyntheticEvent<Element, Event>, value: string) => {
if (value === '') {
setOptions([]);
setOpen(false);
} else {
setSearchUserLoading(true);
fetchSuggestions(value).then((filteredData) => {
setOptions(filteredData);
const handleInputChange = debounce(
async (_event: React.SyntheticEvent<Element, Event>, value: string) => {
if (value === '') {
setOptions([]);
setOpen(false);
} else {
setSearchUserLoading(true);
const suggestions = await fetchSuggestions(value);
setOptions(suggestions);
setSearchUserLoading(false);
});
setError(false);
setOpen(true);
}
};

setError(false);
setOpen(true);
}
},
300
);
/**
* Clone customUsersList component to pass necessary props
*/
Expand Down

0 comments on commit 6209c54

Please sign in to comment.