MapStore2 icon indicating copy to clipboard operation
MapStore2 copied to clipboard

Not possible to remove widget from Map - JavaScript error

Open mahmoudadel54 opened this issue 4 months ago • 0 comments

Description

In a map with a lot of widgets added it is not possible to remove the widgets from the map.

The issue iat this line in code: https://github.com/geosolutions-it/MapStore2/blob/08772cd25a7746e941ed4a33265e3ddee40237f0/web/client/reducers/widgets.js#L185

const [, dependentWidgetId] = WIDGETS_REGEX.exec((Object.values(m.dependenciesMap) || [])[0]);

if dependenciesMap = {} so this line doesn't handle this case specifically and raises an error WIDGETS_REGEX.exec([])[0] ---> null so trying to destructure null throws an error object null is not iterable

How to reproduce

  • Open this map
  • Try to delete a widget [counter widget or bar chart widget] not the pie chart one
  • The dialog window shows up with the delete confirm message
  • Click on Delete

Expected Result The widget should be removed from the map and the dialog window close automatically

Current Result The confirmation dialog window remains open and the widget is not removed from the map. A JavaScript console error pops up

Uncaught TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))
   
  • [x] Not browser related
Browser info (use this site: https://www.whatsmybrowser.org/ for non expert users)
Browser Affected Version
Internet Explorer
Edge
Chrome
Firefox
Safari

Other useful information

mahmoudadel54 avatar Oct 23 '24 07:10 mahmoudadel54