| 137 | } |
| 138 | |
| 139 | set (attributes, options) { |
| 140 | if (attributes !== 'thangs') { delete this.attributesWithDefaults } // unless attributes is 'thangs': performance optimization for Levels keeping their cache. |
| 141 | const inFlux = this.loading || !this.loaded |
| 142 | if (!inFlux && !this._revertAttributes && !this.project && !(options != null ? options.fromMerge : undefined)) { this.markToRevert() } |
| 143 | if (_.isString(attributes) && ((attributes === 'undefined') || (attributes === undefined))) { |
| 144 | console.error(`Blocking setting of ${attributes} property to ${this.constructor.className} model with value ${options}`) |
| 145 | return |
| 146 | } else if (_.isObject(attributes) && ('undefined' in attributes)) { |
| 147 | console.error(`Blocking setting of \`undefined\` property key to ${this.constructor.className} model with value ${attributes.undefined}`) |
| 148 | delete attributes.undefined |
| 149 | } |
| 150 | const res = super.set(attributes, options) |
| 151 | if (this.saveBackups && (!inFlux)) { this.saveBackup() } |
| 152 | return res |
| 153 | } |
| 154 | |
| 155 | buildAttributesWithDefaults () { |
| 156 | const t0 = new Date() |