From 3c643b1cf637d9d0cb4606de8ac0071cd339ce60 Mon Sep 17 00:00:00 2001 From: Jose Buitron Date: Thu, 9 May 2024 11:28:11 -0500 Subject: [PATCH] fix: Sort data layers by title --- src/storyMap/components/StoryMapForm/DataLayerDialog.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/storyMap/components/StoryMapForm/DataLayerDialog.js b/src/storyMap/components/StoryMapForm/DataLayerDialog.js index e897a9c7ba..2ce7e113ac 100644 --- a/src/storyMap/components/StoryMapForm/DataLayerDialog.js +++ b/src/storyMap/components/StoryMapForm/DataLayerDialog.js @@ -50,6 +50,10 @@ const DataLayerDialog = props => { [dataLayers] ); + const sortedDataLayers = useMemo(() => { + return _.sortBy([dataLayer => dataLayer.title?.toLowerCase()], dataLayers); + }, [dataLayers]); + useFetchData(fetchDataLayers); const onConfirmWrapper = useCallback(() => { @@ -100,7 +104,7 @@ const DataLayerDialog = props => { onChange={event => setSelected(event.target.value)} > - {dataLayers.map(dataLayer => ( + {sortedDataLayers.map(dataLayer => ( ({