|
58 | 58 | }); |
59 | 59 |
|
60 | 60 | onMount(() => { |
61 | | - Promise.all([ |
62 | | - db.feeds.isReady(), |
63 | | - db.episodes.isReady(), |
64 | | - db.activeEpisodes.isReady(), |
65 | | - db.settings.isReady(), |
66 | | - db.logs.isReady(), |
67 | | - db.searchHistory.isReady() |
68 | | - ]).then(async () => { |
69 | | - isDbReady = true; |
70 | | - Log.initServiceWorkerLogging(); |
71 | | - SettingsService.initializeSettings(); |
72 | | - runRatchets(); |
73 | | - feedService.startPeriodicUpdates(); |
74 | | - searchHistoryService.startPeriodicUpdates(); |
75 | | - EpisodeService.startPeriodicUpdates(); |
76 | | -
|
77 | | - if (isPwa && !isPwaConfigured) { |
78 | | - SettingsService.markPwaInstalled(); |
79 | | - } |
80 | | -
|
81 | | - if (import.meta.env.VITE_EXPOSE_GLOBAL_DB === '1') { |
82 | | - (window as any).db = db; |
83 | | - } |
84 | | -
|
85 | | - // share takes care of hiding the loading screen |
86 | | - // do this last |
87 | | - if (!page.url.pathname.startsWith('/share')) { |
88 | | - const loadingScreen = document.getElementById('appLoading'); |
89 | | - if (loadingScreen) { |
90 | | - loadingScreen.remove(); |
| 61 | + try { |
| 62 | + Promise.all([ |
| 63 | + db.feeds.isReady(), |
| 64 | + db.episodes.isReady(), |
| 65 | + db.activeEpisodes.isReady(), |
| 66 | + db.settings.isReady(), |
| 67 | + db.logs.isReady(), |
| 68 | + db.searchHistory.isReady() |
| 69 | + ]).then(() => { |
| 70 | + isDbReady = true; |
| 71 | +
|
| 72 | + try { |
| 73 | + Log.initServiceWorkerLogging(); |
| 74 | + SettingsService.initializeSettings(); |
| 75 | + runRatchets(); |
| 76 | + feedService.startPeriodicUpdates(); |
| 77 | + searchHistoryService.startPeriodicUpdates(); |
| 78 | + EpisodeService.startPeriodicUpdates(); |
| 79 | + } catch (error) { |
| 80 | + Log.error(`Error at startup after DB ready: ${error}`); |
91 | 81 | } |
92 | | - } |
93 | | - }); |
| 82 | +
|
| 83 | + if (isPwa && !isPwaConfigured) { |
| 84 | + SettingsService.markPwaInstalled(); |
| 85 | + } |
| 86 | +
|
| 87 | + if (import.meta.env.VITE_EXPOSE_GLOBAL_DB === '1') { |
| 88 | + (window as any).db = db; |
| 89 | + } |
| 90 | +
|
| 91 | + // share takes care of hiding the loading screen |
| 92 | + // do this last |
| 93 | + if (!page.url.pathname.startsWith('/share')) { |
| 94 | + const loadingScreen = document.getElementById('appLoading'); |
| 95 | + if (loadingScreen) { |
| 96 | + loadingScreen.remove(); |
| 97 | + } |
| 98 | + } |
| 99 | + }); |
| 100 | + } catch (error) { |
| 101 | + alert(`Error at startup before DB ready, yell at Dan: ${error}`); |
| 102 | + } |
94 | 103 | }); |
95 | 104 |
|
96 | 105 | let { children } = $props(); |
|
0 commit comments