aboutsummaryrefslogtreecommitdiff
path: root/vnext/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-08-24 16:55:53 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:53 +0300
commitaa52bb339a6016e8ed7833b9abaa4e0abb7f2351 (patch)
treea57cc4dfc65fb2ff7388b0d543809ce53020dcea /vnext/src
parent11ea9ad7a922ee80734a3a9c7f3ae8c94fe46522 (diff)
initial reload fix
Diffstat (limited to 'vnext/src')
-rw-r--r--vnext/src/App.js2
-rw-r--r--vnext/src/components/Feeds.js6
2 files changed, 7 insertions, 1 deletions
diff --git a/vnext/src/App.js b/vnext/src/App.js
index 730deb19..3ca7e0bf 100644
--- a/vnext/src/App.js
+++ b/vnext/src/App.js
@@ -29,7 +29,7 @@ export default class App extends React.Component {
}
this.state = {
visitor: {
- uid: cookies.load('_juick_uid') || 0,
+ uid: Number(cookies.load('_juick_uid')),
hash: cookies.load('hash')
}
};
diff --git a/vnext/src/components/Feeds.js b/vnext/src/components/Feeds.js
index 11466d23..89eb7774 100644
--- a/vnext/src/components/Feeds.js
+++ b/vnext/src/components/Feeds.js
@@ -72,6 +72,12 @@ class Feed extends React.Component {
componentDidMount() {
this.loadMessages(this.props.visitor.hash, this.props.location.search);
}
+
+ shouldComponentUpdate(nextProps, nextState) {
+ return this.props.visitor.uid !== nextProps.visitor.uid
+ || this.state !== nextState || this.props.location !== nextProps.location;
+ }
+
getSnapshotBeforeUpdate(prevProps) {
return (this.props.location.search != prevProps.location.search
|| this.props.visitor != prevProps.visitor || this.props.query.search != prevProps.query.search);