From 24804bc845cdfe76ee67abd673214d265b3d9dde Mon Sep 17 00:00:00 2001 From: Ivan Suslov Date: Fri, 16 Feb 2018 07:58:12 +0700 Subject: [PATCH 1/3] Update order fix #148 #185 #148 #164 --- app-route.html | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app-route.html b/app-route.html index 9478f53..445a75f 100644 --- a/app-route.html +++ b/app-route.html @@ -286,7 +286,6 @@ this._matched = matched.join('/'); - // Properties that must be updated atomically. var propertyUpdates = {}; //this.active @@ -318,8 +317,10 @@ } if (this.setProperties) { - // atomic update - this.setProperties(propertyUpdates, true); + //Update properties in a specific order: data, active, tail + propertyUpdates.hasOwnProperty("data") && this.set("data", propertyUpdates.data); + propertyUpdates.hasOwnProperty("active") && this._setActive(propertyUpdates.active); + propertyUpdates.hasOwnProperty("tail") && this.set("tail", propertyUpdates.tail); } else { this.__setMulti(propertyUpdates); } From 5cefdc13d253cfc96696c18833d94250895cb674 Mon Sep 17 00:00:00 2001 From: Ivan Suslov Date: Fri, 16 Feb 2018 10:25:33 +0700 Subject: [PATCH 2/3] Set inactive while updating `data` and `tail` if `data` changed, even if it matches the pattern --- app-route.html | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app-route.html b/app-route.html index 445a75f..96545c6 100644 --- a/app-route.html +++ b/app-route.html @@ -317,10 +317,15 @@ } if (this.setProperties) { - //Update properties in a specific order: data, active, tail - propertyUpdates.hasOwnProperty("data") && this.set("data", propertyUpdates.data); - propertyUpdates.hasOwnProperty("active") && this._setActive(propertyUpdates.active); + //Update properties in a specific order: data, tail and set inactive during update if data changed + if(propertyUpdates.hasOwnProperty("data")){ + this._setActive(false) + this.set("data", propertyUpdates.data); + } propertyUpdates.hasOwnProperty("tail") && this.set("tail", propertyUpdates.tail); + if(propertyUpdates.hasOwnProperty("data") || propertyUpdates.active){ + this._setActive(true); + } } else { this.__setMulti(propertyUpdates); } From a909d64712831d86a636f6086ed2898a6593854f Mon Sep 17 00:00:00 2001 From: Ivan Suslov Date: Fri, 16 Feb 2018 11:02:28 +0700 Subject: [PATCH 3/3] Run unit tests with setProperties internals --- app-route.html | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app-route.html b/app-route.html index 96545c6..fa57b6a 100644 --- a/app-route.html +++ b/app-route.html @@ -318,14 +318,10 @@ if (this.setProperties) { //Update properties in a specific order: data, tail and set inactive during update if data changed - if(propertyUpdates.hasOwnProperty("data")){ - this._setActive(false) - this.set("data", propertyUpdates.data); - } - propertyUpdates.hasOwnProperty("tail") && this.set("tail", propertyUpdates.tail); - if(propertyUpdates.hasOwnProperty("data") || propertyUpdates.active){ - this._setActive(true); - } + propertyUpdates.hasOwnProperty("data") && this._setPendingPropertyOrPath("data", propertyUpdates.data, true); + propertyUpdates.hasOwnProperty("tail") && this._setPendingPropertyOrPath("tail", propertyUpdates.tail, true); + propertyUpdates.hasOwnProperty("active") && this._setPendingPropertyOrPath("active", propertyUpdates.active, true); + this._invalidateProperties(); } else { this.__setMulti(propertyUpdates); }