From 8835a3efd334e76f519ae3d3527d4ffc2f30d8fa Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Wed, 2 Nov 2022 15:37:32 +1300 Subject: [PATCH] Prevent double initializing typeorm App is re-mounted when the system theme is changed, but the connection to the sqlite database stays active. This means the previous code would fail to initialize and then be a blank screen. Closes #107 --- App.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/App.tsx b/App.tsx index 8b3c703..8b62db0 100644 --- a/App.tsx +++ b/App.tsx @@ -54,7 +54,7 @@ const App = () => { console.log(`${Routes.name}.toast:`, {value}) setSnackbar(value) }) - if (AppDataSource.isInitialized) return + if (AppDataSource.isInitialized) return setInitialized(true) AppDataSource.initialize().then(async () => { const settings = await settingsRepo.findOne({where: {}}) console.log(`${App.name}.useEffect:`, {gotSettings: settings})