diff --git a/src/dispatcher/application.tsx b/src/dispatcher/application.tsx index 925f862a8..d915c18be 100644 --- a/src/dispatcher/application.tsx +++ b/src/dispatcher/application.tsx @@ -56,6 +56,16 @@ export default (store: Store, logger: Logger) => { }); }); + // windowIsFocussed is initialized in the store before the app is fully ready. + // So wait until everything is up and running and then check and set the isFocussed state. + window.addEventListener('flipper-store-ready', () => { + const isFocussed = currentWindow.isFocused(); + store.dispatch({ + type: 'windowIsFocused', + payload: isFocussed, + }); + }); + ipcRenderer.on( 'flipper-protocol-handler', (_event: string, query: string) => {