This is an automated email from the ASF dual-hosted git repository.
harbs pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 5f70ba1 Only change valid states
5f70ba1 is described below
commit 5f70ba1dffd86ca5f2dc6bd749799be9fb123abf
Author: Harbs <[email protected]>
AuthorDate: Wed Feb 12 21:59:36 2020 +0200
Only change valid states
---
.../royale/org/apache/royale/routing/RouteToState.as | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git
a/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/RouteToState.as
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/RouteToState.as
index 334da2f..a548842 100644
---
a/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/RouteToState.as
+++
b/frameworks/projects/Basic/src/main/royale/org/apache/royale/routing/RouteToState.as
@@ -18,6 +18,7 @@
////////////////////////////////////////////////////////////////////////////////
package org.apache.royale.routing
{
+ import org.apache.royale.core.IState;
import org.apache.royale.core.IStatesObject;
import org.apache.royale.core.IStrand;
import org.apache.royale.debugging.assert;
@@ -34,7 +35,7 @@ package org.apache.royale.routing
override public function set strand(value:IStrand):void
{
super.strand = value;
- listenOnStrand("stateChange",stateChanged)
+ listenOnStrand("stateChange",stateChanged);
// attach state change event async to allow adding the parent strand
after this is added.
callLater(attachStateEvent);
}
@@ -84,7 +85,18 @@ package org.apache.royale.routing
{
settingState = true;
//TODO what about using the base name of the path?
- getStateComponent().currentState = host.routeState.path;
+ var stateName:String = host.routeState.path;
+ var stateComponent:IStatesObject = getStateComponent();
+ var states:Array = stateComponent.states;
+ //only change the state if the new value is a valid state
+ for each(var state:IState in states)
+ {
+ if(state.name == stateName)
+ {
+ stateComponent.currentState = stateName;
+ break;
+ }
+ }
settingState = false;
}