Compare commits

...

3 Commits

@ -87,7 +87,7 @@ module.exports = function createCompositeObject(options) {
compositeObject.recalculateSize(); compositeObject.recalculateSize();
}); });
compositeObject.objects[objectName].on("renderedToCache", () => { compositeObject.objects[objectName].on("bustedCache", () => {
compositeObject.bustCache(); compositeObject.bustCache();
}); });
}); });

@ -36,17 +36,24 @@ module.exports = function createObject(options) {
transformedProperties = properties; transformedProperties = properties;
} }
Object.keys(transformedProperties).forEach((property) => {
/* Don't apply unchanged properties, to prevent unnecessary cache or size busting. */
if (this[property] === transformedProperties[property]) {
delete transformedProperties[property];
}
});
if (Object.keys(transformedProperties).length > 0) {
Object.assign(this, transformedProperties); Object.assign(this, transformedProperties);
if (Object.keys(transformedProperties).some(property => this.sizeBustingProperties.includes(property))) { if (Object.keys(transformedProperties).some(property => this.sizeBustingProperties.includes(property))) {
/* If the size changes, the cache should also be implicitly busted. */ /* If the size changes, the cache should also be implicitly busted. */
this.bustSize(); this.bustSize();
this.bustCache(); this.bustCache();
} } else if (Object.keys(transformedProperties).some(property => this.cacheBustingProperties.includes(property))) {
if (Object.keys(transformedProperties).some(property => this.cacheBustingProperties.includes(property))) {
this.bustCache(); this.bustCache();
} }
}
}, },
render: function renderObject(context, options = {}) { render: function renderObject(context, options = {}) {
if (this.isCached === false) { if (this.isCached === false) {

Loading…
Cancel
Save