diff --git a/src/fb-stubs/Prefetcher.tsx b/src/fb-stubs/Prefetcher.tsx index 34b6d0f44..a9cd824c1 100644 --- a/src/fb-stubs/Prefetcher.tsx +++ b/src/fb-stubs/Prefetcher.tsx @@ -7,5 +7,7 @@ * @format */ -export default async function setupPrefetcher() {} +import {Settings} from '../reducers/settings'; + +export default async function setupPrefetcher(_settings: Settings) {} export const shouldInstallPrefetcher = () => false; diff --git a/src/init.tsx b/src/init.tsx index 639ddeb02..6b3ebf162 100644 --- a/src/init.tsx +++ b/src/init.tsx @@ -77,7 +77,8 @@ const AppFrame = () => { }; function setProcessState(store: Store) { - const androidHome = store.getState().settingsState.androidHome; + const settings = store.getState().settingsState; + const androidHome = settings.androidHome; if (!process.env.ANDROID_HOME) { process.env.ANDROID_HOME = androidHome; @@ -89,6 +90,10 @@ function setProcessState(store: Store) { ['emulator', 'tools', 'platform-tools'] .map(directory => path.resolve(androidHome, directory)) .join(':') + `:${process.env.PATH}`; + + window.requestIdleCallback(() => { + setupPrefetcher(settings); + }); } function init() { @@ -96,10 +101,6 @@ function init() { initLauncherHooks(config(), store); const sessionId = store.getState().application.sessionId; initCrashReporter(sessionId || ''); - - window.requestIdleCallback(() => { - setupPrefetcher(); - }); } // rehydrate app state before exposing init