Skip to content

Commit

Permalink
Fix crash in old browsers (mastodon#15985)
Browse files Browse the repository at this point in the history
  • Loading branch information
ClearlyClaire authored and chrisguida committed Feb 26, 2022
1 parent 644e503 commit b2e105e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions app/javascript/mastodon/features/ui/components/columns_area.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,11 @@ class ColumnsArea extends ImmutablePureComponent {
}

if (this.mediaQuery) {
this.mediaQuery.addEventListener('change', this.handleLayoutChange);
if (this.mediaQuery.addEventListener) {
this.mediaQuery.addEventListener('change', this.handleLayoutChange);
} else {
this.mediaQuery.addListener(this.handleLayoutChange);
}
this.setState({ renderComposePanel: !this.mediaQuery.matches });
}

Expand Down Expand Up @@ -125,7 +129,11 @@ class ColumnsArea extends ImmutablePureComponent {
}

if (this.mediaQuery) {
this.mediaQuery.removeEventListener('change', this.handleLayoutChange);
if (this.mediaQuery.removeEventListener) {
this.mediaQuery.removeEventListener('change', this.handleLayoutChange);
} else {
this.mediaQuery.removeListener(this.handleLayouteChange);
}
}
}

Expand Down

0 comments on commit b2e105e

Please sign in to comment.