From 7403dc2ebd537c646c6851a356faa726e03d1d20 Mon Sep 17 00:00:00 2001 From: Sam Verhaegen Date: Fri, 27 Oct 2023 23:03:39 +0300 Subject: [PATCH 1/5] fix `SelectOptions` toggling blackout when `props.blackout` is set to `false` --- resources/js/components/select-options.tsx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/resources/js/components/select-options.tsx b/resources/js/components/select-options.tsx index 863c9ce77a8..35799546377 100644 --- a/resources/js/components/select-options.tsx +++ b/resources/js/components/select-options.tsx @@ -47,12 +47,14 @@ export default class SelectOptions extends React.Component) { super(props); makeObservable(this); - disposeOnUnmount(this, reaction( - () => this.showingSelector, - (showing) => { - blackoutToggle(showing, 0.5); - }, - )); + if (props.blackout) { + disposeOnUnmount(this, reaction( + () => this.showingSelector, + (showing) => { + blackoutToggle(showing, 0.5); + }, + )); + } } componentDidMount() { From 0b588caa4130b053a2a126c7e3026b8ee10b1eb4 Mon Sep 17 00:00:00 2001 From: Sam Verhaegen Date: Mon, 30 Oct 2023 11:50:02 +0200 Subject: [PATCH 2/5] move `props.blackout` check to inside the reaction --- resources/js/components/select-options.tsx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/resources/js/components/select-options.tsx b/resources/js/components/select-options.tsx index 35799546377..59f92102334 100644 --- a/resources/js/components/select-options.tsx +++ b/resources/js/components/select-options.tsx @@ -47,14 +47,14 @@ export default class SelectOptions extends React.Component) { super(props); makeObservable(this); - if (props.blackout) { - disposeOnUnmount(this, reaction( - () => this.showingSelector, - (showing) => { + disposeOnUnmount(this, reaction( + () => this.showingSelector, + (showing) => { + if (props.blackout) { blackoutToggle(showing, 0.5); - }, - )); - } + } + }, + )); } componentDidMount() { From fa8ea5c4a25b503c8367582f4bdafa3e357e9fde Mon Sep 17 00:00:00 2001 From: Sam Verhaegen Date: Mon, 30 Oct 2023 15:49:14 +0200 Subject: [PATCH 3/5] make `blackout` part of reaction value --- resources/js/components/select-options.tsx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/js/components/select-options.tsx b/resources/js/components/select-options.tsx index 59f92102334..f18cf5e8912 100644 --- a/resources/js/components/select-options.tsx +++ b/resources/js/components/select-options.tsx @@ -48,10 +48,10 @@ export default class SelectOptions extends React.Component this.showingSelector, - (showing) => { - if (props.blackout) { - blackoutToggle(showing, 0.5); + () => ({ blackout: this.props.blackout, showing: this.showingSelector }), + (value) => { + if (value.blackout) { + blackoutToggle(value.showing, 0.5); } }, )); From 43a2588029a7d51f0702045b75b086580430814e Mon Sep 17 00:00:00 2001 From: Sam Verhaegen Date: Tue, 31 Oct 2023 09:38:06 +0200 Subject: [PATCH 4/5] add nanaya's suggestion --- resources/js/components/select-options.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/resources/js/components/select-options.tsx b/resources/js/components/select-options.tsx index f18cf5e8912..6ea077a21aa 100644 --- a/resources/js/components/select-options.tsx +++ b/resources/js/components/select-options.tsx @@ -48,11 +48,9 @@ export default class SelectOptions extends React.Component ({ blackout: this.props.blackout, showing: this.showingSelector }), + () => this.props.blackout && this.showingSelector, (value) => { - if (value.blackout) { - blackoutToggle(value.showing, 0.5); - } + blackoutToggle(value ?? false, 0.5); }, )); } From 72e06bece97b9302d17183e464aead9eaa9a0307 Mon Sep 17 00:00:00 2001 From: bakaneko Date: Tue, 31 Oct 2023 20:05:47 +0900 Subject: [PATCH 5/5] missing handler --- resources/js/beatmap-discussions/main.coffee | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/js/beatmap-discussions/main.coffee b/resources/js/beatmap-discussions/main.coffee index 9e7ec8dad6d..2470352fba8 100644 --- a/resources/js/beatmap-discussions/main.coffee +++ b/resources/js/beatmap-discussions/main.coffee @@ -153,6 +153,7 @@ export class Main extends React.PureComponent currentBeatmap: @currentBeatmap() currentUser: @state.currentUser innerRef: @newDiscussionRef + onFocus: @handleNewDiscussionFocus pinned: @state.pinnedNewDiscussion setPinned: @setPinnedNewDiscussion stickTo: @modeSwitcherRef