Skip to content

Commit

Permalink
Merge pull request #1520 from ajoensson/issue-1507/org-switcher-order…
Browse files Browse the repository at this point in the history
…ing-filter-result

Retain order of organizations in OrgSwitcher during filtering
  • Loading branch information
rebecarubio authored Sep 12, 2023
2 parents a54ebc2 + 15e909a commit 86c54bb
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ function useOrgSwitcher(orgId: number, searchString: string) {
const recentOrgsFuse = useMemo(() => {
return new Fuse(recentOrgs, {
keys: ['title'],
shouldSort: false,
threshold: 0.4,
});
}, [recentOrgs]);
Expand All @@ -61,7 +62,11 @@ function useOrgSwitcher(orgId: number, searchString: string) {
}, [searchString]);

const allOrgsFuse = useMemo(() => {
return new Fuse(flatOrgData, { keys: ['title'], threshold: 0.4 });
return new Fuse(flatOrgData, {
keys: ['title'],
shouldSort: false,
threshold: 0.4,
});
}, [flatOrgData]);

const filteredAllOrgs = useMemo(() => {
Expand Down

0 comments on commit 86c54bb

Please sign in to comment.