@ -1,12 +1,14 @@
import classNames from 'classnames' ;
import React from 'react' ;
import NotificationsContainer from './containers/notifications_container' ;
import { HotKeys } from 'react-hotkeys' ;
import { defineMessages , injectIntl } from 'react-intl' ;
import { connect } from 'react-redux' ;
import { Redirect , withRouter } from 'react-router-dom' ;
import PropTypes from 'prop-types' ;
import NotificationsContainer from './containers/notifications_container' ;
import LoadingBarContainer from './containers/loading_bar_container' ;
import TabsBar from './components/tabs_bar' ;
import ModalContainer from './containers/modal_container' ;
import { connect } from 'react-redux' ;
import { Redirect , withRouter } from 'react-router-dom' ;
import { isMobile } from '../../is_mobile' ;
import { debounce } from 'lodash' ;
import { uploadCompose , resetCompose } from '../../actions/compose' ;
@ -44,9 +46,8 @@ import {
PinnedStatuses ,
Lists ,
} from './util/async-components' ;
import { HotKeys } from 'react-hotkeys' ;
import { me } from '../../initial_state' ;
import { defineMessages , injectIntl } from 'react-int l';
import { previewState } from './components/media_moda l';
// Dummy import, to make sure that <Status /> ends up in the application bundle.
// Without this it ends up in ~8 very commonly used bundles.
@ -117,6 +118,10 @@ class SwitchingColumnsArea extends React.PureComponent {
window . removeEventListener ( 'resize' , this . handleResize ) ;
}
shouldUpdateScroll ( _ , { location } ) {
return location . state !== previewState ;
}
handleResize = debounce ( ( ) => {
// The cached heights are no longer accurate, invalidate
this . props . onLayoutChange ( ) ;
@ -141,36 +146,36 @@ class SwitchingColumnsArea extends React.PureComponent {
{ redirect }
< WrappedRoute path = '/getting-started' component = { GettingStarted } content = { children } / >
< WrappedRoute path = '/keyboard-shortcuts' component = { KeyboardShortcuts } content = { children } / >
< WrappedRoute path = '/timelines/home' component = { HomeTimeline } content = { children } / >
< WrappedRoute path = '/timelines/public' exact component = { PublicTimeline } content = { children } / >
< WrappedRoute path = '/timelines/public/media' component = { PublicTimeline } content = { children } componentParams = { { onlyMedia : true } } / >
< WrappedRoute path = '/timelines/public/local' exact component = { CommunityTimeline } content = { children } / >
< WrappedRoute path = '/timelines/public/local/media' component = { CommunityTimeline } content = { children } componentParams = { { onlyMedia : true } } / >
< WrappedRoute path = '/timelines/direct' component = { DirectTimeline } content = { children } / >
< WrappedRoute path = '/timelines/tag/:id' component = { HashtagTimeline } content = { children } / >
< WrappedRoute path = '/timelines/list/:id' component = { ListTimeline } content = { children } / >
< WrappedRoute path = '/notifications' component = { Notifications } content = { children } / >
< WrappedRoute path = '/favourites' component = { FavouritedStatuses } content = { children } / >
< WrappedRoute path = '/pinned' component = { PinnedStatuses } content = { children } / >
< WrappedRoute path = '/timelines/home' component = { HomeTimeline } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/timelines/public' exact component = { PublicTimeline } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/timelines/public/media' component = { PublicTimeline } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll , onlyMedia : true } } / >
< WrappedRoute path = '/timelines/public/local' exact component = { CommunityTimeline } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/timelines/public/local/media' component = { CommunityTimeline } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll , onlyMedia : true } } / >
< WrappedRoute path = '/timelines/direct' component = { DirectTimeline } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/timelines/tag/:id' component = { HashtagTimeline } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/timelines/list/:id' component = { ListTimeline } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/notifications' component = { Notifications } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/favourites' component = { FavouritedStatuses } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/pinned' component = { PinnedStatuses } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/search' component = { Compose } content = { children } componentParams = { { isSearchPage : true } } / >
< WrappedRoute path = '/statuses/new' component = { Compose } content = { children } / >
< WrappedRoute path = '/statuses/:statusId' exact component = { Status } content = { children } / >
< WrappedRoute path = '/statuses/:statusId/reblogs' component = { Reblogs } content = { children } / >
< WrappedRoute path = '/statuses/:statusId/favourites' component = { Favourites } content = { children } / >
< WrappedRoute path = '/accounts/:accountId' exact component = { AccountTimeline } content = { children } / >
< WrappedRoute path = '/accounts/:accountId/with_replies' component = { AccountTimeline } content = { children } componentParams = { { withReplies : true } } / >
< WrappedRoute path = '/accounts/:accountId/followers' component = { Followers } content = { children } / >
< WrappedRoute path = '/accounts/:accountId/following' component = { Following } content = { children } / >
< WrappedRoute path = '/accounts/:accountId/media' component = { AccountGallery } content = { children } / >
< WrappedRoute path = '/follow_requests' component = { FollowRequests } content = { children } / >
< WrappedRoute path = '/blocks' component = { Blocks } content = { children } / >
< WrappedRoute path = '/domain_blocks' component = { DomainBlocks } content = { children } / >
< WrappedRoute path = '/mutes' component = { Mutes } content = { children } / >
< WrappedRoute path = '/statuses/:statusId' exact component = { Status } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/statuses/:statusId/reblogs' component = { Reblogs } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/statuses/:statusId/favourites' component = { Favourites } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/accounts/:accountId' exact component = { AccountTimeline } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/accounts/:accountId/with_replies' component = { AccountTimeline } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll , withReplies : true } } / >
< WrappedRoute path = '/accounts/:accountId/followers' component = { Followers } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/accounts/:accountId/following' component = { Following } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/accounts/:accountId/media' component = { AccountGallery } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/follow_requests' component = { FollowRequests } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/blocks' component = { Blocks } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/domain_blocks' component = { DomainBlocks } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/mutes' component = { Mutes } content = { children } componentParams = { { shouldUpdateScroll : this . shouldUpdateScroll } } / >
< WrappedRoute path = '/lists' component = { Lists } content = { children } / >
< WrappedRoute component = { GenericNotFound } content = { children } / >