Skip to content

🧠 5️⃣ Resolve "Fix converting a link row field does not update fields which depend on it's reverse field"

This MR fixes a bug when:

  1. You create a field which depends on a link row field
  2. You convert the link_row_related_field of that link row field to any other field type
  3. Your dependant field will have not been updated

This bug was caused by:

  1. The FieldDependency model has a via FK (DELETE cascade) to the LinkRowField table
  2. When a LinkRowField is converted to another field type, the row in the LinkRowField table is deleted, causing all FieldDependency rows which went via that LinkRowField to be deleted due to the cascade
  3. We wouldn't then be able to update those dependants as the dependnecies were just deleted from the graph

Also

  1. 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:

  1. Finds all dependencies that will be broken by a type change
  2. Makes sure to call them and tell them their dependant has been updated
  3. 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

Merge request reports