Skip to content

Access single item at startup #23

Answered by mergesort
batjoc asked this question in Q&A
Jul 20, 2022 · 1 comments · 14 replies
Discussion options

You must be logged in to vote

Hey @batjoc! Apologies but not too sorry for the delay, I've been on vacation and wanted to really give myself a nice break. 🙂

You're right that the first access of Store.items will return [] on startup, that's something I want to improve but I'm honestly not sure how. The issue is that there has to be a default value, and since the initial query of all the persisted items has to take place on the @MainActor, there will be some non-zero initialization time when the Task is dispatched.

I do think I have some potential help for you though. I've been working hard on a 2.0 releases of Boutique and Bodega, and one of the improvements is the ability to have a @StoredValue type, similar to @Store.…

Replies: 1 comment 14 replies

Comment options

You must be logged in to vote
14 replies
@mergesort
Comment options

@batjoc
Comment options

@mergesort
Comment options

@batjoc
Comment options

@mergesort
Comment options

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