Commit 3b03b720 by Wee

fix(prevRouter): save prevRouter only when neccessary

parent f39d07da
...@@ -162,9 +162,12 @@ class Route extends React.Component { ...@@ -162,9 +162,12 @@ class Route extends React.Component {
// 匹配正常渲染 // 匹配正常渲染
console.log('---- NORMAL MATCH FLAG ----') console.log('---- NORMAL MATCH FLAG ----')
this.liveState = NORMAL_RENDER_MATCH this.liveState = NORMAL_RENDER_MATCH
this._prevRouter = this.context.router
return match return match
} else if ((livePathMatch || props.alwaysLive) && this.routeDom) { } else if ((livePathMatch || props.alwaysLive) && this.routeDom) {
// 在从正常渲染到隐藏的时候备份 router
if (prevMatch) {
this._prevRouter = this.context.router
}
// 隐藏渲染 // 隐藏渲染
console.log('---- HIDE FLAG----') console.log('---- HIDE FLAG----')
this.liveState = HIDE_RENDER this.liveState = HIDE_RENDER
......
{ {
"name": "react-live-route", "name": "react-live-route",
"version": "1.1.14", "version": "1.1.15",
"description": "A living route for react-router-v4", "description": "A living route for react-router-v4",
"repository": "fi3ework/react-live-route", "repository": "fi3ework/react-live-route",
"license": "MIT", "license": "MIT",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment