Managing time-consuming actions during the initialization of Tauri Apps with Native DB #8489
-
I have released an embedded database Now, let's get to the heart of the matter: Native DB has an automatic migration system for models. It's best to do this at the initialization of the application, and it can take time, depending on the size of the user data. In my example, I naively put it in the app's |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I'd call putting it into the setup hook best practice. If you don't need access to anything from the If you want to migrate the db and start the app at the same time i'd spawn a thread in the setup hook and would likely move the db builder stuff into it too and also get an If you don't want it to block the loading of the app you could spawn a thread in the setup hook |
Beta Was this translation helpful? Give feedback.
I'd call putting it into the setup hook best practice. If you don't need access to anything from the
App
/Window
instances doing it before the tauri::Builder line is pretty much the same though.If you want to migrate the db and start the app at the same time i'd spawn a thread in the setup hook and would likely move the db builder stuff into it too and also get an
AppHandle
viaapp.handle()
to be able to set the state in a command, that way you can get rid of the Arc (since tauri::State is basically one already)If you don't want it to block the loading of the app you could spawn a thread in the setup hook