Closed Qsppl closed 3 months ago
That's a design choice, if your definition contains nested model(s), they are fetched on-demand, but as the model. If you need only ids, please change your model definition to:
{
items: [String],
...,
}
I have written some code using Hybrids.js with external libraries such as Leaflet and AmCharts, and in all cases I was unable to use Hybrids.js models for various reasons, such as replacing the model object in the store when using store.connect.set
.
This always comes down to using model IDs instead of models, but this is awkward and leads to a lot of unnecessary code, so I still try to use models directly.
I thought the data loading was called when using special helpers like store.ready(...items)
or store.resolve(...items)
- this seems logical.
Library users are unlikely to expect that iteration of a list of models will cause loading of data inside these models, and most likely no one writes their components based on this behavior of the list.
If it is intentionally implemented this way, nothing can be done. Thanks for the answer.
I just iterate through the related models, and they start loading from the remote storage.
I expect that model data will not be loaded until it is needed, the ids of these models are enough for me.
Example: https://codepen.io/qsppl/pen/qBzoXNo