fix: skip initial formset rows in syncDeletedRows - #199
Conversation
Do not hide rows marked with data-sbadmin-formset-initial-row when their DELETE checkbox is checked. Saved rows should stay visible (marked for deletion); only newly added rows should be hidden via syncDeletedRows.
f75c237 to
07ec941
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f75c237c11
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (row.hasAttribute(INITIAL_ROW_ATTR)) { | ||
| return |
There was a problem hiding this comment.
Keep initial rows visible after delete clicks
When a saved row marked with data-sbadmin-formset-initial-row is deleted via a data-sbadmin-formset-delete-row button, deleteFormsetRow() has already checked the DELETE input and added .hidden before calling syncDeletedRows(). This new early return then skips the only code that could reconcile the row visibility, so the saved row still disappears instead of staying visible while marked for deletion. The initial-row path needs to avoid the immediate hide or explicitly remove .hidden here.
Useful? React with 👍 / 👎.
Do not hide rows marked with data-sbadmin-formset-initial-row when their DELETE checkbox is checked. Saved rows should stay visible (marked for deletion); only newly added rows should be hidden via syncDeletedRows.