[5.6] Fix: revert model syncing after soft-delete #25392
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This reverts the changes made in PR #24400
Why?
By immediately syncing the original model array, you could no longer retrieve changed values from the
'deleted'
model event. This differs from the behavior of other model events such as'created'
and'updated'
.Since you can manually call
syncOriginal
anyway, it seems it would be more desirable to leave the behavior ofdeleted
in line with the other model events than to break this behavior for everyone without offering an opt-out:Tests
I have left in the tests from the previous PR and just added the manual syncing to show that those cases are still supported. By all means I can remove them.
If required I can also add some tests to ensure that changes on the model can be accessed after deleting.
Let me know.