Skip to content
Discussion options

You must be logged in to vote

I put it in the app's setup [...] I'm sure there's a best practice

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 via app.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

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@vincent-herlemont
Comment options

Answer selected by vincent-herlemont
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants