Skip to content

Commit

Permalink
Merge pull request #10857 from notbakaneko/feature/fix-initial-stick-…
Browse files Browse the repository at this point in the history
…to-height

Fix new discussion pinned position
  • Loading branch information
nanaya authored Jan 19, 2024
2 parents 01720be + 8c2c2bb commit 0a0e215
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions resources/js/beatmap-discussions/new-discussion.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,13 @@ export class NewDiscussion extends React.Component<Props> {
}

componentDidMount() {
this.updateStickToHeight();
// watching for height changes on the stickTo element to handle horizontal scrollbars when they appear.
$(window).on('resize', this.updateStickToHeight);
this.disposers.add(core.reactTurbolinks.runAfterPageLoad(action(() => this.mounted = true)));
this.disposers.add(core.reactTurbolinks.runAfterPageLoad(action(() => {
this.mounted = true;
this.updateStickToHeight();
})));

if (this.props.autoFocus) {
this.disposers.add(core.reactTurbolinks.runAfterPageLoad(() => this.inputBox.current?.focus()));
}
Expand Down
6 changes: 4 additions & 2 deletions resources/js/beatmap-discussions/new-review.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,12 @@ export default class NewReview extends React.Component<Props> {
}

componentDidMount(): void {
this.updateStickToHeight();
// watching for height changes on the stickTo element to handle horizontal scrollbars when they appear.
$(window).on('resize', this.updateStickToHeight);
this.disposers.add(core.reactTurbolinks.runAfterPageLoad(action(() => this.mounted = true)));
this.disposers.add(core.reactTurbolinks.runAfterPageLoad(action(() => {
this.mounted = true;
this.updateStickToHeight();
})));
}

componentWillUnmount(): void {
Expand Down

0 comments on commit 0a0e215

Please sign in to comment.