Files
Santhi Prakash de457c2f3c fix(applications): defer attachment storage changes until the edit is saved (#3556)
Removing or picking an attachment in the application form used to hit storage
immediately, before the sheet was saved or cancelled. Cancelling after removing
left the application pointing at a deleted file (broken reference), and
cancelling after uploading orphaned the new file in storage.

FileAttachmentField is now a pure value control that reports picks/removals
instead of calling storage itself. ApplicationFormSheet keeps the picked File
staged (with a blob-URL preview) until submit, then uploads -> writes the
record -> deletes replaced files, in that order. Closing the sheet without
saving only drops files orphaned by a failed save attempt.

ApplicationDetailSheet has no save/cancel step, so it applies changes
immediately through the applications.attachDocument/removeDocument procedures,
which order upload/persist/delete server-side with cross-application
reference checks.

Fixes #3555
2026-10-04 18:37:14 +02:00
..