Skip to content

Commit

Permalink
fix: Sort data layers by title
Browse files Browse the repository at this point in the history
  • Loading branch information
josebui committed May 9, 2024
1 parent 6432166 commit 3c643b1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/storyMap/components/StoryMapForm/DataLayerDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ const DataLayerDialog = props => {
[dataLayers]
);

const sortedDataLayers = useMemo(() => {
return _.sortBy([dataLayer => dataLayer.title?.toLowerCase()], dataLayers);
}, [dataLayers]);

useFetchData(fetchDataLayers);

const onConfirmWrapper = useCallback(() => {
Expand Down Expand Up @@ -100,7 +104,7 @@ const DataLayerDialog = props => {
onChange={event => setSelected(event.target.value)}
>
<List>
{dataLayers.map(dataLayer => (
{sortedDataLayers.map(dataLayer => (
<ListItem
key={dataLayer.id}
sx={theme => ({
Expand Down

0 comments on commit 3c643b1

Please sign in to comment.