|
4 | 4 | import BeatmapListItem from 'components/beatmap-list-item';
|
5 | 5 | import BeatmapExtendedJson from 'interfaces/beatmap-extended-json';
|
6 | 6 | import UserJson from 'interfaces/user-json';
|
7 |
| -import { action, computed, makeObservable, observable } from 'mobx'; |
8 |
| -import { observer } from 'mobx-react'; |
| 7 | +import { action, autorun, computed, makeObservable, observable } from 'mobx'; |
| 8 | +import { disposeOnUnmount, observer } from 'mobx-react'; |
9 | 9 | import { deletedUserJson } from 'models/user';
|
10 | 10 | import * as React from 'react';
|
11 | 11 | import { makeUrl } from 'utils/beatmapset-discussion-helper';
|
@@ -34,16 +34,19 @@ export default class BeatmapList extends React.Component<Props> {
|
34 | 34 | super(props);
|
35 | 35 |
|
36 | 36 | makeObservable(this);
|
| 37 | + disposeOnUnmount(this, autorun(() => { |
| 38 | + blackoutToggle(this, this.showingSelector); |
| 39 | + })); |
37 | 40 | }
|
38 | 41 |
|
39 | 42 | componentDidMount() {
|
40 | 43 | $(document).on(`click.${this.eventId}`, this.onDocumentClick);
|
41 | 44 | $(document).on(`turbolinks:before-cache.${this.eventId}`, this.handleBeforeCache);
|
42 |
| - blackoutToggle(this.showingSelector, 0.5); |
43 | 45 | }
|
44 | 46 |
|
45 | 47 | componentWillUnmount() {
|
46 | 48 | $(document).off(`.${this.eventId}`);
|
| 49 | + blackoutToggle(this, false); |
47 | 50 | }
|
48 | 51 |
|
49 | 52 | render() {
|
@@ -127,7 +130,6 @@ export default class BeatmapList extends React.Component<Props> {
|
127 | 130 | @action
|
128 | 131 | private setShowingSelector(state: boolean) {
|
129 | 132 | this.showingSelector = state;
|
130 |
| - blackoutToggle(state, 0.5); |
131 | 133 | }
|
132 | 134 |
|
133 | 135 | @action
|
|
0 commit comments