mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Fixing react warnings on permalink return
This commit is contained in:
@@ -28,18 +28,19 @@ export default class PermalinkView extends React.Component {
|
|||||||
const channel = ChannelStore.getCurrent();
|
const channel = ChannelStore.getCurrent();
|
||||||
const channelId = channel ? channel.id : '';
|
const channelId = channel ? channel.id : '';
|
||||||
const channelName = channel ? channel.name : '';
|
const channelName = channel ? channel.name : '';
|
||||||
const teamURL = TeamStore.getCurrentTeamUrl();
|
const team = TeamStore.getCurrent();
|
||||||
|
const teamName = team ? team.name : '';
|
||||||
const profiles = JSON.parse(JSON.stringify(UserStore.getProfiles()));
|
const profiles = JSON.parse(JSON.stringify(UserStore.getProfiles()));
|
||||||
return {
|
return {
|
||||||
channelId,
|
channelId,
|
||||||
channelName,
|
channelName,
|
||||||
profiles,
|
profiles,
|
||||||
teamURL,
|
teamName,
|
||||||
postId
|
postId
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
isStateValid() {
|
isStateValid() {
|
||||||
return this.state.channelId !== '' && this.state.profiles && this.state.teamURL;
|
return this.state.channelId !== '' && this.state.profiles && this.state.teamName;
|
||||||
}
|
}
|
||||||
updateState() {
|
updateState() {
|
||||||
this.setState(this.getStateFromStores(this.props));
|
this.setState(this.getStateFromStores(this.props));
|
||||||
@@ -64,7 +65,7 @@ export default class PermalinkView extends React.Component {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextState.teamURL !== this.state.teamURL) {
|
if (nextState.teamName !== this.state.teamName) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,7 +88,7 @@ export default class PermalinkView extends React.Component {
|
|||||||
id='archive-link-home'
|
id='archive-link-home'
|
||||||
>
|
>
|
||||||
<Link
|
<Link
|
||||||
to={this.state.teamURL + '/channels/' + this.state.channelName}
|
to={'/' + this.state.teamName + '/channels/' + this.state.channelName}
|
||||||
>
|
>
|
||||||
<FormattedMessage
|
<FormattedMessage
|
||||||
id='center_panel.recent'
|
id='center_panel.recent'
|
||||||
|
|||||||
@@ -384,6 +384,7 @@ export default class PostsView extends React.Component {
|
|||||||
}
|
}
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
window.removeEventListener('resize', this.handleResize);
|
window.removeEventListener('resize', this.handleResize);
|
||||||
|
this.scrollStopAction.cancel();
|
||||||
}
|
}
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
if (this.props.postList != null) {
|
if (this.props.postList != null) {
|
||||||
|
|||||||
@@ -24,4 +24,8 @@ export default class DelayedAction {
|
|||||||
|
|
||||||
this.timer = window.setTimeout(this.fire, timeout);
|
this.timer = window.setTimeout(this.fire, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cancel() {
|
||||||
|
window.clearTimeout(this.timer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user