specify / specify7

Specify 7
https://www.specifysoftware.org/products/specify-7/
GNU General Public License v2.0
66 stars 36 forks source link

Error message when deleting tree ranks that have associated nodes #5025

Open Areyes42 opened 5 months ago

Areyes42 commented 5 months ago

Describe the bug A brief error message appears when attempting to delete tree ranks associated with a node via the Storage Tree Def Items menu.

To Reproduce Steps to reproduce the behavior:

  1. Go to a tree
  2. Click on the edit pencil next to the tree name
  3. Click the 'Tree Def Items' button
  4. Try deleting a rank with nodes
  5. Save
  6. See error

Expected behavior When attempting to delete a tree rank that has associated nodes, a save blocker should be enforced, similar to the mechanism used when deleting with the pencil button.

Screenshots

https://github.com/specify/specify7/assets/130881183/9be2bca7-d115-4c8f-9740-80db12e9492b

Please, also fill out the following information manually:

acwhite211 commented 5 months ago

Ya good catch, the error dialog that pops up before refreshing the page has always been happening. There isn't any problems with add/deleting the ranks. The pop up is just hard to debug on the front-end because the page refreshes so quickly. It's probably not a real issue for 7.9.6.

realVinayak commented 5 months ago

@acwhite211 You'll need to confirm, but it very likely chokes below https://github.com/specify/specify7/blob/c62b400cec7732b856e25451df042bb8898a0d51/specifyweb/specify/api.py#L636

Set a breakpoint below for that. https://github.com/specify/specify7/blob/c62b400cec7732b856e25451df042bb8898a0d51/specifyweb/specify/api.py#L635

I think it is a real bug, but one that maybe non-trivial to fix.

Was going to work on fixing the refresh bug, but didn't get time. For now, comment out this line (or well, remove the reload call) https://github.com/specify/specify7/blob/c62b400cec7732b856e25451df042bb8898a0d51/specifyweb/frontend/js_src/lib/components/TreeView/Tree.tsx#L272

realVinayak commented 5 months ago

The root of the bug is not specific to tree ranks (any place that deletes dependent to-many will have that bug). For now, showing the error dialog. Will be useful for future anyways (to get crash report or pretty format the dialog)

emenslin commented 4 months ago

Can recreate in edge (7.9.6)