pgadmin4 icon indicating copy to clipboard operation
pgadmin4 copied to clipboard

i.default.find(...) is undefined when trying to delete table or link in ERD

Open KaylaSolace opened this issue 1 year ago • 2 comments

Please note that security bugs or issues should be reported to [email protected].

Describe the bug

While using the erd tool, occasionally tables or links will become impossible to delete, triggering a "i.default.find(...) is undefined" error in the console

To Reproduce

Steps to reproduce the behavior:

  1. Create ERD
  2. Make some tables and links
  3. Rename tables and columns a few times
  4. Some links and tables cannot be deleted anymore

Expected behavior

To be able to delete links and tables

Error message

Uncaught TypeError: i.default.find(...) is undefined removeOneToManyLink http://localhost:5050/static/js/generated/erd_tool.js?ver=81400:1 removeOneToManyLink http://localhost:5050/static/js/generated/erd_tool.js?ver=81400:1 onDeleteNode http://localhost:5050/static/js/generated/erd_tool.js?ver=81400:1 onDeleteNode http://localhost:5050/static/js/generated/erd_tool.js?ver=81400:1 onOkClick http://localhost:5050/static/js/generated/erd_tool.js?ver=81400:1 Oe http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 He http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 jr http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 jr http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 Nr http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 Vr http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 cc http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 Me http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 Vr http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 Qt http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 Ut http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 erd_tool.js:1:814489 removeOneToManyLink http://localhost:5050/static/js/generated/erd_tool.js?ver=81400:1 forEach self-hosted:157 removeOneToManyLink http://localhost:5050/static/js/generated/erd_tool.js?ver=81400:1 onDeleteNode http://localhost:5050/static/js/generated/erd_tool.js?ver=81400:1 forEach self-hosted:157 onDeleteNode http://localhost:5050/static/js/generated/erd_tool.js?ver=81400:1 onOkClick http://localhost:5050/static/js/generated/erd_tool.js?ver=81400:1 Oe http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 He http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 jr http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 jr http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 Nr http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 Vr http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 cc http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 Me http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 Vr http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 Qt http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2 Ut http://localhost:5050/static/js/generated/vendor.react.js?ver=81400:2

error in chromium:

Uncaught TypeError: Cannot read properties of undefined (reading 'attnum') at erd_tool.js?ver=81400:1:814537 at Array.forEach (<anonymous>) at t.default.removeOneToManyLink (erd_tool.js?ver=81400:1:814445) at erd_tool.js?ver=81400:1:810413 at Array.forEach (<anonymous>) at erd_tool.js?ver=81400:1:810398 at Array.forEach (<anonymous>) at t.default.removeNode (erd_tool.js?ver=81400:1:810357) at erd_tool.js?ver=81400:1:835931 at Array.forEach (<anonymous>)

Desktop (please complete the following information):

  • OS: Arch Linux
  • Version: 8.14
  • Mode: Server
  • Browser (if running in server mode): Firefox @ ver 133.0.3
  • Package type: Python, installed via uv tool install

Additional context

Of note, this is an ERD for tables that do not actually exist in the database.

KaylaSolace avatar Jan 03 '25 08:01 KaylaSolace

Ok, yes. looking at the generated SQL this seems to be from renaming tables or columns. the links seem to keep their connection to the table visually but lose what they are actually connected to when the name changes. thus, deleting them requires renaming the table and or column back to the existing name.

KaylaSolace avatar Jan 03 '25 09:01 KaylaSolace

potentially may be solved by solving #7903

KaylaSolace avatar Jan 03 '25 09:01 KaylaSolace