Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
handle ephemeral case different for refresh.
  • Loading branch information
joenoon committed Mar 25, 2016
commit 7230d162aa6cb5e784c769fbab770fc8310782cc
15 changes: 14 additions & 1 deletion src/Reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,20 @@ function update(state,action){

case REFRESH_ACTION:
let ind = -1;
el.children.forEach((c,i)=>{if (c.key==action.key){ind=i}});
for (let i=0; i < el.children.length; i++) {
let c = el.children[i];
if (c.ephemeral) {
if (c.key === action.key) {
ind = i;
break;
}
} else {
if (c.sceneKey === action.key) {
ind = i;
break;
}
}
}
assert(ind!=-1, "Cannot find route with key="+action.key+" for parent="+el.key);
el.children[ind] = getInitialState(newProps, newState.scenes, ind, action);
return newState;
Expand Down