From 13ce0c9f88515ca52b242c814e998bc2de5fc7ba Mon Sep 17 00:00:00 2001 From: Wouter Vroege Date: Wed, 2 Sep 2020 09:28:27 +0200 Subject: [PATCH] fix: properies-changed-callback causing render block Signed-off-by: Wouter Vroege --- src/addons/properties-changed-callback-mixin.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/addons/properties-changed-callback-mixin.js b/src/addons/properties-changed-callback-mixin.js index 38aaa16..aa2e0c8 100644 --- a/src/addons/properties-changed-callback-mixin.js +++ b/src/addons/properties-changed-callback-mixin.js @@ -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);