Issue:
A TypeError: Cannot read properties of undefined (reading 'getLayer') was observed in fdm-app/app/components/blocks/atlas/atlas-panels.tsx.
This error occurs when the updatePanel function attempts to access map.getLayer(layer) before the map's style object has been fully initialized or after it has been removed. Specifically, map.getLayer relies on this.style, which can be undefined during these states.
Cause:
The map object exists, but its internal style reference (this.style) is undefined at the moment getLayer is called, leading to a crash when accessing getLayer.
Fix:
Added a guard clause to check if map.getStyle() returns a valid object before attempting to call map.getLayer().
// Modified in fdm-app/app/components/blocks/atlas/atlas-panels.tsx
if (!map.getStyle() || !map.getLayer(layer)) return
This ensures that layer queries are only attempted when the map is in a valid state to handle them.
Issue:
A
TypeError: Cannot read properties of undefined (reading 'getLayer')was observed infdm-app/app/components/blocks/atlas/atlas-panels.tsx.This error occurs when the
updatePanelfunction attempts to accessmap.getLayer(layer)before the map's style object has been fully initialized or after it has been removed. Specifically,map.getLayerrelies onthis.style, which can be undefined during these states.Cause:
The
mapobject exists, but its internal style reference (this.style) is undefined at the momentgetLayeris called, leading to a crash when accessinggetLayer.Fix:
Added a guard clause to check if
map.getStyle()returns a valid object before attempting to callmap.getLayer().This ensures that layer queries are only attempted when the map is in a valid state to handle them.