From bef674a93699757076e77db36fa270c0ea8b0d59 Mon Sep 17 00:00:00 2001 From: Kevin Schaaf Date: Wed, 20 Feb 2019 19:17:14 -0800 Subject: [PATCH] Add comments per review feedback --- lib/mixins/property-accessors.js | 1 + lib/mixins/property-effects.js | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/mixins/property-accessors.js b/lib/mixins/property-accessors.js index bd2cb77b8a..3a9ccaf6b5 100644 --- a/lib/mixins/property-accessors.js +++ b/lib/mixins/property-accessors.js @@ -291,6 +291,7 @@ export const PropertyAccessors = dedupingMixin(superClass => { */ _definePropertyAccessor(property, readOnly) { if (legacyNoBatch) { + // Ensure properties are not flushed when adding instance effects const ready = this.__dataReady; this.__dataReady = false; saveAccessorValue(this, property); diff --git a/lib/mixins/property-effects.js b/lib/mixins/property-effects.js index 83bca57070..5580cd9e24 100644 --- a/lib/mixins/property-effects.js +++ b/lib/mixins/property-effects.js @@ -1570,7 +1570,8 @@ export const PropertyEffects = dedupingMixin(superClass => { this._flushClients(); // Capture element data and flush properties one-by one to defeat // Polymer 2.x's batched _propertiesChanged scheme; this approximates - // 1.x's applyConfig + // 1.x's applyConfig. Data is reset to mimic 1.x behavior of + // properties incrementally being initialized const changedProps = this.__data; const notify = this.__dataToNotify; this.__data = {}; @@ -1732,7 +1733,9 @@ export const PropertyEffects = dedupingMixin(superClass => { // Compute properties if (legacyNoBatch) { // When not batching, computed effects may re-enter, so capture - // notifying properties early + // notifying properties early. Use simple runEffects rather than + // runComputedEffects since computed effects will run immediately + // rather than being batched. notifyProps = this.__dataToNotify; this.__dataToNotify = null; runEffects(this, this[TYPES.COMPUTE], changedProps, oldProps, hasPaths);