erquhartE
Convex Community3y ago
10 replies
erquhart

Updating the UI for relational batch deletions

Let's say I have an entity that's related to a lot of other entities. If I delete it, I need to paginate through multiple tables to delete the relations first, so I schedule those.

Currently I'm setting isDeleted: true on the entity being deleted, which allows me to update the UI right away for the immediate action.

In places where related data is being fetched (often paginated), however, I don't see a great way to index/filter for this in queries, so filtering the result based on a list of "deleted" foreign keys is my best bet it seems, which could make paginating odd when large chunks or even entire pages are missing in the filtered result.

Just checking to see if I'm missing a better way here.

Obviously the golden ticket here is full on relationship support with cascading deletes, but something that could help in the meantime: q.in()/q.nin() support for filters. This way I could provide a list of ids to filter out for the foreign key field.
Was this page helpful?