From 40bc957b21e6d521fd632e522fbc64e307f652e1 Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Wed, 23 Oct 2019 04:14:55 -0700 Subject: [PATCH] Show uncatched errors to developers Summary: To make (accidental) errors more visible to developers of Flipper, all uncaught and FBLogger logged errors will be shown in the UI and prefixed with `[DEV]`. This is only done in non-production builds Reviewed By: jknoxville Differential Revision: D18061174 fbshipit-source-id: 9dab0e8d34396b0cb421a4d4e6fc14c81447d190 --- src/init.tsx | 1 + types/globals.tsx | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/init.tsx b/src/init.tsx index 6b3ebf162..5913263c2 100644 --- a/src/init.tsx +++ b/src/init.tsx @@ -101,6 +101,7 @@ function init() { initLauncherHooks(config(), store); const sessionId = store.getState().application.sessionId; initCrashReporter(sessionId || ''); + window.flipperGlobalStoreDispatch = store.dispatch; } // rehydrate app state before exposing init diff --git a/types/globals.tsx b/types/globals.tsx index 0d3cc4a6a..66ebf8425 100644 --- a/types/globals.tsx +++ b/types/globals.tsx @@ -9,6 +9,7 @@ import {StoreEnhancerStoreCreator} from 'redux'; import {ResizeObserver} from './ResizeObserver.d'; +import {Store} from '../src/reducers'; export {}; type RequestIdleHandle = number; @@ -19,6 +20,8 @@ declare global { } interface Window { + flipperGlobalStoreDispatch: Store['dispatch']; + __REDUX_DEVTOOLS_EXTENSION__: | undefined | StoreEnhancerStoreCreator & StoreEnhancerStateSanitizer;