From 8698cd3281ac1d699c723a151b14f1e2f2e8b07e Mon Sep 17 00:00:00 2001
From: Eugen Rochko <eugen@zeonfederated.com>
Date: Tue, 18 Oct 2016 23:06:28 +0200
Subject: Remember scroll position when navigating back, do not needlessly
 reload entire timelines (only fetch since last known ID). Side effect:
 account timelines no longer update in real-time

---
 app/assets/javascripts/components/containers/mastodon.jsx | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'app/assets/javascripts/components/containers/mastodon.jsx')

diff --git a/app/assets/javascripts/components/containers/mastodon.jsx b/app/assets/javascripts/components/containers/mastodon.jsx
index e5c0887a9..4eb9f83c8 100644
--- a/app/assets/javascripts/components/containers/mastodon.jsx
+++ b/app/assets/javascripts/components/containers/mastodon.jsx
@@ -10,11 +10,13 @@ import { setAccessToken } from '../actions/meta';
 import { setAccountSelf } from '../actions/accounts';
 import PureRenderMixin    from 'react-addons-pure-render-mixin';
 import {
+  applyRouterMiddleware,
   Router,
   Route,
   hashHistory,
   IndexRoute
 }                         from 'react-router';
+import { useScroll }      from 'react-router-scroll';
 import UI                 from '../features/ui';
 import Account            from '../features/account';
 import Status             from '../features/status';
@@ -71,7 +73,7 @@ const Mastodon = React.createClass({
   render () {
     return (
       <Provider store={store}>
-        <Router history={hashHistory}>
+        <Router history={hashHistory} render={applyRouterMiddleware(useScroll())}>
           <Route path='/' component={UI}>
             <IndexRoute component={GettingStarted} />
             <Route path='/statuses/new' component={Compose} />
-- 
cgit 

