mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
[Glitch] Refactor: Remove Status unsafe lifecycles
Port 605b5b91c9 to glitch-soc
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
@@ -160,8 +160,8 @@ class Status extends ImmutablePureComponent {
|
||||
};
|
||||
|
||||
componentDidMount () {
|
||||
attachFullscreenListener(this.onFullScreenChange);
|
||||
this.props.dispatch(fetchStatus(this.props.params.statusId, { forceFetch: true }));
|
||||
attachFullscreenListener(this.onFullScreenChange);
|
||||
}
|
||||
|
||||
static getDerivedStateFromProps(props, state) {
|
||||
@@ -169,7 +169,6 @@ class Status extends ImmutablePureComponent {
|
||||
let updated = false;
|
||||
|
||||
if (props.params.statusId && state.statusId !== props.params.statusId) {
|
||||
props.dispatch(fetchStatus(props.params.statusId, { forceFetch: true }));
|
||||
update.threadExpanded = undefined;
|
||||
update.statusId = props.params.statusId;
|
||||
updated = true;
|
||||
@@ -519,8 +518,8 @@ class Status extends ImmutablePureComponent {
|
||||
this.statusNode = c;
|
||||
};
|
||||
|
||||
componentDidUpdate (prevProps) {
|
||||
const { status, descendantsIds } = this.props;
|
||||
componentDidUpdate(prevProps) {
|
||||
const { status, descendantsIds, params } = this.props;
|
||||
|
||||
const isSameStatus = status && (prevProps.status?.get('id') === status.get('id'));
|
||||
|
||||
@@ -532,6 +531,14 @@ class Status extends ImmutablePureComponent {
|
||||
this.setState({newRepliesIds});
|
||||
}
|
||||
}
|
||||
|
||||
if (params.statusId && prevProps.params.statusId !== params.statusId) {
|
||||
this.props.dispatch(fetchStatus(params.statusId, { forceFetch: true }));
|
||||
}
|
||||
|
||||
if (status && status.get('id') !== this.state.loadedStatusId) {
|
||||
this.setState({ showMedia: defaultMediaVisibility(this.props.status), loadedStatusId: status.get('id') });
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount () {
|
||||
|
||||
Reference in New Issue
Block a user