Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-render Attachment View if there are changes other than the current setting #8256

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/js/media/views/attachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,13 +578,19 @@ _.each({
return this;
}

/*
* Re-render if attributes other than the current setting have also changed.
* This ensures all model changes are reflected in the view.
*/
var otherChanges = _.difference( _.keys( model.changedAttributes() ), [ setting ] );

/*
* If the updated value is in sync with the value in the DOM, there
* is no need to re-render. If we're currently editing the value,
* it will automatically be in sync, suppressing the re-render for
* the view we're editing, while updating any others.
*/
if ( value === $setting.find('input, textarea, select, [value]').val() ) {
if ( _.isEmpty( otherChanges ) && value === $setting.find('input, textarea, select, [value]').val() ) {
return this;
}

Expand Down
Loading