You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I thought the beforeSelect lifecycle hook could be a good place to run the axios request but this lifecycle should ONLY return a collection and not a Promise. So, is it a good idea to approach the problem this way?
If so, is it possible to have an alternative beforeSelect which returns a Promise?
Thanks!
The text was updated successfully, but these errors were encountered:
Probably not a good idea. All hooks such as beforeSelect are synchronous and should be used to handle read/write logic for data going in or out of the store.
You could use modules to manage entity-related state to determine whether logic needs to be executed in parallel such as requests to endpoints. Think of it as a layer of abstraction between components and vuex orm.
I'm interested in achieving something similar - lazy loading results from an API on first access. Having done some quick experimentation, the following approach does seem to work...
I am trying to load model with data when empty
I thought the beforeSelect lifecycle hook could be a good place to run the axios request but this lifecycle should ONLY return a collection and not a Promise.
So, is it a good idea to approach the problem this way?
If so, is it possible to have an alternative beforeSelect which returns a Promise?
Thanks!
The text was updated successfully, but these errors were encountered: