|
1 | 1 | // @flow |
2 | 2 | import * as React from 'react'; |
3 | 3 | import compose from 'recompose/compose'; |
4 | | -import PromiseQueue from './helpers/p-queue'; |
5 | 4 | import { Route, Switch, Redirect } from 'react-router'; |
6 | 5 | import styled, { ThemeProvider } from 'styled-components'; |
7 | 6 | import Loadable from 'react-loadable'; |
@@ -154,47 +153,6 @@ const ComposerFallback = signedOutFallback(Composer, () => ( |
154 | 153 | <Login redirectPath={`${CLIENT_URL}/new/thread`} /> |
155 | 154 | )); |
156 | 155 |
|
157 | | -// On the client, preload the important routes when browser is idle and users has been using the app |
158 | | -// for > 5s (i.e. all the data should hopefully have been loaded) |
159 | | -if (!global || global.IS_SERVER !== true) { |
160 | | - const preload = [ |
161 | | - FullscreenThreadView, |
162 | | - CommunityView, |
163 | | - CommunityLoginView, |
164 | | - UserView, |
165 | | - ChannelView, |
166 | | - Dashboard, |
167 | | - Notifications, |
168 | | - ]; |
169 | | - |
170 | | - requestAnimationFrame(() => { |
171 | | - // Fallback to setTimeout for older browsers with no requestIdleCallback support |
172 | | - const idle = window.requestIdleCallback || window.setTimeout; |
173 | | - const queue = new PromiseQueue({ |
174 | | - concurrency: 2, |
175 | | - }); |
176 | | - idle(() => { |
177 | | - // Wait 5 seconds to make sure the data has loaded |
178 | | - setTimeout(() => { |
179 | | - preload.forEach(bundle => { |
180 | | - queue |
181 | | - .add(() => { |
182 | | - return new Promise(res => { |
183 | | - idle(() => { |
184 | | - bundle |
185 | | - .preload() |
186 | | - .then(res) |
187 | | - .catch(err => console.error(err)); |
188 | | - }); |
189 | | - }); |
190 | | - }) |
191 | | - .catch(err => console.error(err)); |
192 | | - }); |
193 | | - }, 5000); |
194 | | - }); |
195 | | - }); |
196 | | -} |
197 | | - |
198 | 156 | type Props = { |
199 | 157 | currentUser: ?GetUserType, |
200 | 158 | isLoadingCurrentUser: boolean, |
|
0 commit comments