From b02bfe86ce26ef001420841673257c9c5326b45c Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Fri, 27 Jul 2018 17:59:52 +0200 Subject: Don't reset scroll position when opening a modal --- .../flavours/glitch/features/standalone/community_timeline/index.js | 5 +++++ .../flavours/glitch/features/standalone/hashtag_timeline/index.js | 5 +++++ 2 files changed, 10 insertions(+) (limited to 'app/javascript/flavours/glitch/features/standalone') diff --git a/app/javascript/flavours/glitch/features/standalone/community_timeline/index.js b/app/javascript/flavours/glitch/features/standalone/community_timeline/index.js index c488f9541..08b9e9e57 100644 --- a/app/javascript/flavours/glitch/features/standalone/community_timeline/index.js +++ b/app/javascript/flavours/glitch/features/standalone/community_timeline/index.js @@ -47,6 +47,10 @@ export default class CommunityTimeline extends React.PureComponent { this.props.dispatch(expandCommunityTimeline({ maxId })); } + shouldUpdateScroll = (prevRouterProps, { location }) => { + return !(location.state && location.state.mastodonModalOpen) + } + render () { const { intl } = this.props; @@ -62,6 +66,7 @@ export default class CommunityTimeline extends React.PureComponent { timelineId='community' onLoadMore={this.handleLoadMore} scrollKey='standalone_public_timeline' + shouldUpdateScroll={this.shouldUpdateScroll} trackScroll={false} /> diff --git a/app/javascript/flavours/glitch/features/standalone/hashtag_timeline/index.js b/app/javascript/flavours/glitch/features/standalone/hashtag_timeline/index.js index dc02f1c91..d2b1971ec 100644 --- a/app/javascript/flavours/glitch/features/standalone/hashtag_timeline/index.js +++ b/app/javascript/flavours/glitch/features/standalone/hashtag_timeline/index.js @@ -41,6 +41,10 @@ export default class HashtagTimeline extends React.PureComponent { this.props.dispatch(expandHashtagTimeline(this.props.hashtag, { maxId })); } + shouldUpdateScroll = (prevRouterProps, { location }) => { + return !(location.state && location.state.mastodonModalOpen) + } + render () { const { hashtag } = this.props; @@ -55,6 +59,7 @@ export default class HashtagTimeline extends React.PureComponent { -- cgit