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
Is your feature request related to a problem? Please describe...
Suppose that I have a Company model, which has many Employee models.
Currently, I can't do this:
const company = Company.find(123)
console.log(company.employees) // outputs an empty array, even if company 123 does have employees
Instead, I have to make sure that the employees relation gets loaded as part of the initial query:
const company = Company.query().with(['employees']).whereId(123).first()
console.log(company.employees) // outputs the related employees, as expected
If the code which needs to display the employees is in a different part of the app than the code which initially loads the company, this behavior creates a tight coupling between the two parts of the app.
Describe the solution you'd like
When I try to access a relation that hasn't yet been loaded, I would like Vuex ORM to lazy-load the related model(s). This is consistent with other ORMs that I've used, such as Laravel Eloquent.
const company = Company.find(123)
console.log(company.employees) // Vuex ORM sees that this relation hasn't yet been loaded, and lazy-loads it from the store
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe...
Suppose that I have a Company model, which has many Employee models.
Currently, I can't do this:
Instead, I have to make sure that the
employees
relation gets loaded as part of the initial query:If the code which needs to display the
employees
is in a different part of the app than the code which initially loads thecompany
, this behavior creates a tight coupling between the two parts of the app.Describe the solution you'd like
When I try to access a relation that hasn't yet been loaded, I would like Vuex ORM to lazy-load the related model(s). This is consistent with other ORMs that I've used, such as Laravel Eloquent.
The text was updated successfully, but these errors were encountered: