🧠 5️⃣ Resolve "Fix converting a link row field does not update fields which depend on it's reverse field"
requested to merge 1026-fix-converting-a-link-row-field-does-not-update-fields-which-depend-on-it-s-reverse-field into 952-prevent-formulas-ever-generating-bc-dates-as-causes-python-crashes
This MR fixes a bug when:
- You create a field which depends on a link row field
- You convert the
link_row_related_field
of that link row field to any other field type - Your dependant field will have not been updated
This bug was caused by:
- The FieldDependency model has a
via
FK (DELETE cascade) to theLinkRowField
table - When a
LinkRowField
is converted to another field type, the row in theLinkRowField
table is deleted, causing allFieldDependency
rows which wentvia
that LinkRowField to be deleted due to the cascade - We wouldn't then be able to update those dependants as the dependnecies were just deleted from the graph
Also
- When a link row field is converted to another type, it's
link_row_related_field
is also deleted, but without triggering any updates for fields that depend on that field.
Now this MR:
- Finds all dependencies that will be broken by a type change
- Makes sure to call them and tell them their dependant has been updated
- Ensures that the updatecollector never tries to join back when this happens as the m2m table will have been deleted and theres no way to join back anymore.
Merge Request Checklist
-
changelog.md has been updated if required -
New/updated Premium features are separated correctly in the premium folder -
The latest Chrome and Firefox have been used to test any new frontend features -
Documentation has been updated -
Quality Standards are met -
Performance: tables are still fast with 100k+ rows, 100+ field tables -
The redoc API pages have been updated for any REST API changes -
Our custom API docs are updated for changes to endpoints accessed via api tokens -
The UI/UX has been updated following UI Style Guide
Closes #1026 (closed)
Edited by Nigel Gott