Commit 1fdc4082 by Wee

fix: clear scroll position when unmount

parent 961c21a6
...@@ -95,7 +95,6 @@ class Route extends React.Component { ...@@ -95,7 +95,6 @@ class Route extends React.Component {
} }
componentWillReceiveProps(nextProps, nextContext) { componentWillReceiveProps(nextProps, nextContext) {
console.log('into cwrp')
warning( warning(
!(nextProps.location && !this.props.location), !(nextProps.location && !this.props.location),
'<Route> elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.' '<Route> elements should not change from uncontrolled to controlled (or vice versa). You initially used no "location" prop and then provided one on a subsequent render.'
...@@ -139,7 +138,6 @@ class Route extends React.Component { ...@@ -139,7 +138,6 @@ class Route extends React.Component {
componentWillUnmount() { componentWillUnmount() {
if (this.doesRouteEnableLive()) { if (this.doesRouteEnableLive()) {
window.sessionStorage.removeItem(this.routeId) window.sessionStorage.removeItem(this.routeId)
this.routeDom = null
} }
} }
...@@ -193,6 +191,7 @@ class Route extends React.Component { ...@@ -193,6 +191,7 @@ class Route extends React.Component {
console.log('---- NORMAL UNMATCH FLAG----') console.log('---- NORMAL UNMATCH FLAG----')
this.liveState = NORMAL_RENDER_UNMATCH this.liveState = NORMAL_RENDER_UNMATCH
this.routeDom = null this.routeDom = null
window.sessionStorage.removeItem(this.routeId)
} }
} }
......
{ {
"name": "react-live-route", "name": "react-live-route",
"version": "1.1.10", "version": "1.1.11",
"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