Skip to content

Commit

Permalink
fix: makes initalSelectedLayer work
Browse files Browse the repository at this point in the history
  • Loading branch information
FritzHoing committed Sep 22, 2023
1 parent f660f53 commit 55b12b4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/BackgroundLayerChooser/BackgroundLayerChooser.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ export const BackgroundLayerChooser: React.FC<BackgroundLayerChooserProps> = ({

useEffect(() => {
const activeLayerCand = layers.find(l => l.getVisible());
setSelectedLayer(activeLayerCand as OlLayer);

if (!initiallySelectedLayer) {
setSelectedLayer(activeLayerCand as OlLayer);
}
}, [layers]);

useEffect(() => {
Expand Down

0 comments on commit 55b12b4

Please sign in to comment.