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
This commit is contained in:
parent
187a0fbc68
commit
8835a3efd3
2
App.tsx
2
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})
|
||||
|
|
Loading…
Reference in New Issue
Block a user