Skip to content

Commit

Permalink
sort filters using localCompare
Browse files Browse the repository at this point in the history
  • Loading branch information
dauglyon committed Nov 30, 2023
1 parent 9d249e3 commit bcfc11c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/features/collections/CollectionDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ export const CollectionDetail = () => {

const [filterOpen, setFiltersOpen] = useState(false);
const filterMenuRef = useRef<HTMLButtonElement>(null);
const filterEntries = Object.entries(filters || {});
filterEntries.sort((a, b) => a[0].localeCompare(b[0]));

const filterMenu = (
<div>
Expand All @@ -104,7 +106,7 @@ export const CollectionDetail = () => {
open={filterOpen}
onClose={() => setFiltersOpen(false)}
>
{Object.entries(filters || {}).flatMap(([column, filter]) => {
{filterEntries.flatMap(([column, filter]) => {
const hasVal = Boolean(filter.value);
const children = [
<Divider key={column + '__label'} textAlign="left">
Expand Down

0 comments on commit bcfc11c

Please sign in to comment.