Skip to content

Commit 498a077

Browse files
committed
fix: clear the state before leaving the favorite page
1 parent c2bc438 commit 498a077

File tree

1 file changed

+7
-0
lines changed
  • client/components/main/Main/ConnectionSelector

1 file changed

+7
-0
lines changed

client/components/main/Main/ConnectionSelector/Config.jsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ class Config extends React.Component {
3535
if (!this.props.connect && nextProps.connect) {
3636
this.connect();
3737
}
38+
const leaving =
39+
(!this.props.favorite && nextProps.favorite) ||
40+
(this.props.favorite && !nextProps.favorite) ||
41+
(this.props.favorite.get('key') !== nextProps.favorite.get('key'));
42+
if (leaving) {
43+
this.setState({ changed: false, data: new Immutable.Map() });
44+
}
3845
}
3946

4047
connect() {

0 commit comments

Comments
 (0)