Skip to content

Commit

Permalink
feat: Sort Source List Alphabetically (#1218)
Browse files Browse the repository at this point in the history
  • Loading branch information
Skeltons committed Aug 17, 2024
1 parent 86c82c1 commit d06aecb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/screens/browse/components/BrowseTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,18 @@ export const InstalledTab = memo(
);

const searchedPlugins = useMemo(() => {
const sortedInstalledPlugins = filteredInstalledPlugins.sort(
(plgFirst, plgSecond) => plgFirst.name.localeCompare(plgSecond.name),
);
if (searchText) {
const lowerCaseSearchText = searchText.toLocaleLowerCase();
return filteredInstalledPlugins.filter(
return sortedInstalledPlugins.filter(
plg =>
plg.name.toLocaleLowerCase().includes(lowerCaseSearchText) ||
plg.id.includes(lowerCaseSearchText),
);
} else {
return filteredInstalledPlugins;
return sortedInstalledPlugins;
}
}, [searchText, filteredInstalledPlugins]);

Expand Down

0 comments on commit d06aecb

Please sign in to comment.