Browse Source

[Glitch] Fix occasional crash in detailed toot view

Port f9a338b473 to glitch-soc
closed-social-glitch-2
Thibaut Girka 5 years ago
committed by ThibG
parent
commit
2769b54466
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      app/javascript/flavours/glitch/components/status.js

+ 2
- 2
app/javascript/flavours/glitch/components/status.js View File

@ -217,7 +217,7 @@ export default class Status extends ImmutablePureComponent {
this.setState({ autoCollapsed: true }); this.setState({ autoCollapsed: true });
} }
this.didShowCard = !this.props.muted && !this.props.hidden && this.props.status.get('card') && this.props.settings.get('inline_preview_cards');
this.didShowCard = !this.props.muted && !this.props.hidden && this.props.status && this.props.status.get('card') && this.props.settings.get('inline_preview_cards');
} }
getSnapshotBeforeUpdate (prevProps, prevState) { getSnapshotBeforeUpdate (prevProps, prevState) {
@ -230,7 +230,7 @@ export default class Status extends ImmutablePureComponent {
// Hack to fix timeline jumps on second rendering when auto-collapsing // Hack to fix timeline jumps on second rendering when auto-collapsing
componentDidUpdate (prevProps, prevState, snapshot) { componentDidUpdate (prevProps, prevState, snapshot) {
const doShowCard = !this.props.muted && !this.props.hidden && this.props.status.get('card') && this.props.settings.get('inline_preview_cards');
const doShowCard = !this.props.muted && !this.props.hidden && this.props.status && this.props.status.get('card') && this.props.settings.get('inline_preview_cards');
if (this.state.autoCollapsed || (doShowCard && !this.didShowCard)) { if (this.state.autoCollapsed || (doShowCard && !this.didShowCard)) {
if (doShowCard) this.didShowCard = true; if (doShowCard) this.didShowCard = true;
if (this.state.autoCollapsed) this.setState({ autoCollapsed: false }); if (this.state.autoCollapsed) this.setState({ autoCollapsed: false });

Loading…
Cancel
Save