Skip to content

Commit

Permalink
fix: properies-changed-callback causing render block
Browse files Browse the repository at this point in the history
Signed-off-by: Wouter Vroege <[email protected]>
  • Loading branch information
woutervroege committed Sep 2, 2020
1 parent 6edcb80 commit 13ce0c9
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/addons/properties-changed-callback-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ export const PropertiesChangedCallback = (SuperClass) => class extends SuperClas
}

static __addChangedProperty(propName, oldValue) {
window.cancelAnimationFrame(this.__propertiesChangedCallbackDebouncer);
const changedProps = this.__changedProperties;
if(!changedProps.has(propName)) changedProps.set(propName, oldValue);
this.__propertiesChangedCallbackDebouncer = window.requestAnimationFrame(this.constructor.__invokeCallback.bind(this));
if(!this.__changedProperties.has(propName)) this.__changedProperties.set(propName, oldValue);
window.requestAnimationFrame(this.constructor.__invokeCallback.bind(this));
}

static __invokeCallback() {
if(this.__changedProperties.size === 0) return;
const oldValues = {};
const newValues = {};
this.__changedProperties.forEach((oldValue, propName) => oldValues[propName] = oldValue);
Expand Down

0 comments on commit 13ce0c9

Please sign in to comment.