Skip to content

Commit

Permalink
Fix: locked attributes with conflicting default value (#591)
Browse files Browse the repository at this point in the history
  • Loading branch information
oliverfoster authored Oct 15, 2024
1 parent b24f584 commit 6c58433
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions js/models/lockingModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,8 @@ export default class LockingModel extends Backbone.Model {
const defaults = _.result(this, 'defaults');
const isDefault = (defaults[attrName] !== undefined);
const isInitialDefault = (isDefault && !this.changed);
if (isInitialDefault) {
this._lockedAttributes[attrName] = !defaults[attrName];
}

const isSettingValueForSpecificPlugin = options?.pluginName;

if (!isSettingValueForSpecificPlugin) {
if (!isInitialDefault) {
console.error('Must supply a pluginName to change a locked attribute');
Expand Down Expand Up @@ -65,7 +62,7 @@ export default class LockingModel extends Backbone.Model {
}
}

if (!Object.keys(newValues)) return this;
if (!Object.keys(newValues).length) return this;

super.set(newValues, options);

Expand Down

0 comments on commit 6c58433

Please sign in to comment.