Canadian-Geospatial-Platform / geoview

Canadian Geospatial Platform Viewer / Visualiseur de la Plateforme Géospatiale Canadienne
Other
20 stars 31 forks source link

[BUG] Empty Time Slider on Map Delete #2327

Open jolevesq opened 1 week ago

jolevesq commented 1 week ago

Is there an existing issue for this?

Current Behavior

When we switch config in configuration navigator page with time slider, when the maps is deleted it tries to render the the time slider package but state is empty

TypeError: Cannot read properties of undefined (reading 'title')
    at _ (time-slider.tsx:71:5)

time-slider.tsx

const {
    title,
    description,
    defaultValue,
    discreteValues,
    range,
    minAndMax,
    field,
    fieldAlias,
    filtering,
    singleHandle,
    values,
    delay,
    locked,
    reversed,
  } = useTimeSliderLayers()[layerPath];

Expected Behavior

There should be no render on delete

Steps To Reproduce

  1. https://canadian-geospatial-platform.github.io/geoview/public/demos-navigator.html?config=./configs/navigator/10-package-time-slider.json
  2. Play with time slider
  3. Open console
  4. Change to another time slider demo
  5. See the error

Anything else?

No response