OED icon indicating copy to clipboard operation
OED copied to clipboard

UI crashes after deleting a selected map

Open lindavin opened this issue 4 years ago • 5 comments

Describe the bug

When the admin deletes a map that was previously selected, the UI will crash if the admin changes the page.

To Reproduce

Steps to reproduce the behavior:

  1. Go to home page.
  2. Select a map.
  3. Go to maps page by clicking the map header button.
  4. Delete the previously selected map.
  5. Go to home page and see that the UI has crashed and turned into a white screen.

Expected behavior

The UI should not crash. If a selected map is deleted, it should simply not be displayed.

Machine info (please complete the following information)

  • OS: Linux Mint 19
  • Browser & Version: Firefox 87.0
  • OED Version: 0.6.0

lindavin avatar Apr 17 '21 20:04 lindavin

I looked into this some. First, I'm setting the label as low-priority since this seems to only happen if you delete a map while using it. This means an admin must do this so unlikely. Second, I traced the code in src/client/app/containers/MapChartContainer.ts and it makes the map undefined and the image be a new image. This is what I would expect. However, at a later point it gets an exception when it tries to read property image of an undefined object. I'm not sure why this is happening nor where it happened. I'm going to leave this for now.

huss avatar Apr 20 '21 17:04 huss

Sorry I accidentally closed it.

lindavin avatar Apr 27 '21 00:04 lindavin

v1.1 plans to remove the map container for React hooks. This will be looked into again after that change.

huss avatar Apr 22 '23 15:04 huss

Since PR #1113 this is still happening but it catches the error and puts a message on the screen. Hopefully this will be fixed once maps go to RTK (issue #1145). Without looking at this in detail, I would think that clearing the selected map in Redux state if the deleted map is the selected map might fix this.

huss avatar Mar 23 '24 14:03 huss

This is on hold to see if going to the Redux Toolkit will easily solve the issue.

huss avatar May 31 '24 21:05 huss