-
I mean could I initiate an elf state for a component and it will be destroyed after the component is destroyed? |
Beta Was this translation helpful? Give feedback.
Answered by
luii
Nov 18, 2023
Replies: 1 comment 4 replies
-
You can create the store inside the component |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For retrieving Entities from you backend this would be really redundant. Sure you have a loaded and loading state but
query
already has this functionality and is caching it for you, if you dont set astaleTime
/gcTime
(or aleast a really high one) inquery
it wont be garbage collected until that time (means it wont get cleaned up). And as long as this time isnt reached you have a cached result which would be returned first and background fetched right after it.At the baseline i dont recommend to do so, i had it like this and almost every elf store i had was replaced by a service with one or more
query
function. For any non entity sure use elf or akita but when it comes down to entities, t…