Skip to content

Commit 706ce8b

Browse files
committed
Only push to history if the path changes
Closes #205
1 parent 1a5a337 commit 706ce8b

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

static/app.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,11 @@ export class RustwApp extends React.Component {
134134
pathname: path,
135135
state: { highlight }
136136
};
137-
this.props.history.push(location);
137+
if (this.props.location.pathname == path) {
138+
this.props.history.replace(location);
139+
} else {
140+
this.props.history.push(location);
141+
}
138142
}
139143

140144
render() {

static/rustw.out.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6501,7 +6501,11 @@ var RustwApp = exports.RustwApp = function (_React$Component) {
65016501
pathname: path,
65026502
state: { highlight: highlight }
65036503
};
6504-
this.props.history.push(location);
6504+
if (this.props.location.pathname == path) {
6505+
this.props.history.replace(location);
6506+
} else {
6507+
this.props.history.push(location);
6508+
}
65056509
}
65066510
}, {
65076511
key: 'render',
@@ -7512,11 +7516,6 @@ var SourceView = exports.SourceView = function (_React$Component) {
75127516
}
75137517

75147518
_createClass(SourceView, [{
7515-
key: 'componentWillUnmount',
7516-
value: function componentWillUnmount() {
7517-
console.log("unmount");
7518-
}
7519-
}, {
75207519
key: 'componentDidMount',
75217520
value: function componentDidMount() {
75227521
this.componentDidUpdate();

static/rustw.out.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)