aboutsummaryrefslogtreecommitdiff
path: root/vnext/src
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2018-07-06 01:48:09 +0300
committerGravatar Vitaly Takmazov2023-01-13 10:37:53 +0300
commitf62afd8a08d6e5dfdba7eb62d54655bc634e211c (patch)
treeeb2bb22d131cb84efbe514c97b4eb7778a2fc20d /vnext/src
parent148fd4059fb3d8c8bbe8e347c2975a973b442827 (diff)
Update deprecated React API
Diffstat (limited to 'vnext/src')
-rw-r--r--vnext/src/components/Feeds.js18
1 files changed, 13 insertions, 5 deletions
diff --git a/vnext/src/components/Feeds.js b/vnext/src/components/Feeds.js
index 7b6713f6..626732f6 100644
--- a/vnext/src/components/Feeds.js
+++ b/vnext/src/components/Feeds.js
@@ -9,6 +9,7 @@ import Message from './Message';
import Spinner from './Spinner';
import { getMessages } from '../api';
+import { UserType } from './Types';
export function Discover(props) {
const query = {
@@ -69,16 +70,19 @@ class Feed extends React.Component {
componentDidMount() {
this.loadMessages(this.props.visitor.hash, this.props.location.search);
}
- componentWillReceiveProps(nextProps) {
- if (this.props.location.search != nextProps.location.search
- || this.props.visitor != nextProps.visitor) {
- this.loadMessages(nextProps.visitor.hash, nextProps.location.search)
+ getSnapshotBeforeUpdate(prevProps) {
+ return (this.props.location.search != prevProps.location.search
+ || this.props.visitor != prevProps.visitor);
+ }
+ componentDidUpdate(prevProps, prevState, shouldReload) {
+ if (shouldReload) {
+ this.loadMessages(this.props.visitor.hash, this.props.location.search);
}
}
loadMessages = (hash = '', filter = '') => {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
- this.setState({ msgs: [], loading: true })
+ this.setState({ msgs: [], loading: true });
const filterParams = qs.parse(filter);
let params = Object.assign({}, filterParams || {}, this.props.query.search || {});
let url = this.props.query.baseUrl;
@@ -144,6 +148,10 @@ Tag.propTypes = {
};
Feed.propTypes = {
+ authRequired: PropTypes.bool,
+ visitor: UserType,
+ history: ReactRouterPropTypes.history.isRequired,
+ location: ReactRouterPropTypes.location.isRequired,
msgs: PropTypes.array,
query: PropTypes.shape({
baseUrl: PropTypes.string.isRequired,