Skip to content

Commit

Permalink
refactor: sort institution select alphabetically
Browse files Browse the repository at this point in the history
  • Loading branch information
bra-i-am committed Dec 26, 2024
1 parent 9da56e9 commit 47ed439
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/features/Main/InstitutionSelector/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React, {
} from 'react';

import { Row, Col } from '@edx/paragon';
import { Select } from 'react-paragon-topaz';
import { Select, sortAlphabetically } from 'react-paragon-topaz';

import { useLocation, useHistory } from 'react-router-dom';
import { useSelector, useDispatch } from 'react-redux';
Expand Down Expand Up @@ -46,7 +46,8 @@ const InstitutionSelector = () => {
const institutionId = searchParams.get(INSTITUTION_QUERY_ID);

const options = formatSelectOptions(institutions);
setInstitutionOptions(options);
const sortedOptions = sortAlphabetically(options, 'name');
setInstitutionOptions(sortedOptions);

if (institutionId) {
const institutionByQuery = options.filter((option) => option.id === parseInt(institutionId, 10));
Expand Down

0 comments on commit 47ed439

Please sign in to comment.