Skip to content

$derived() with Promise #14606

Answered by brunnerh
5P5 asked this question in Q&A
Dec 7, 2024 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

Your question is not particularly clear. You show a $derived holding a promise but your comment suggest that you don't want a promise at all but just the results of an async operation.

If that is the case you need a $state updated via an $effect. You could set that up in the constructor of the class if you need it to be contained. If the $effect should be independent from any component lifetime, you will need to create an $effect.root around it.

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@5P5
Comment options

@brunnerh
Comment options

Answer selected by 5P5
@5P5
Comment options

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