Skip to content

Commit

Permalink
[front] - fix: improve member search functionality in popovers
Browse files Browse the repository at this point in the history
 - Reset the member list and pagination upon changing the search term to prevent stale results
 - Standardize PopoverContent's padding and margin class order for consistency
  • Loading branch information
Jules authored and Jules committed Oct 21, 2024
1 parent f4bcd7c commit 68123ab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions front/components/vaults/SearchMembersPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ export function SearchMembersPopover({
}, [members, isLoading]);

useEffect(() => {
// reset allMembers when search term changes
setAllMembers(members);
// reset allMembers and pagination when search term changes
setAllMembers([]);
setPagination(DefaultPagination);
}, [members, searchTerm]);
}, [searchTerm]);

const filteredMembers = useMemo(() => {
return allMembers.filter(
Expand Down Expand Up @@ -83,7 +83,7 @@ export function SearchMembersPopover({
<PopoverTrigger>
<Button label="Add members" icon={UserIcon} size="sm" />
</PopoverTrigger>
<PopoverContent className="p-4 mr-2">
<PopoverContent className="mr-2 p-4">
<Searchbar
name="search"
placeholder="Search members (email)"
Expand Down

0 comments on commit 68123ab

Please sign in to comment.