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
In EditController, the _edit() method calls defaultContext() with the related parameter set to true, which eventually causes _modelAttributes() to try to load related fields.
For cc-assess Project instances, this unfortunately produces a Waterline find() operation that tries to load all the GeoRegion instances, which is a bad thing – they won't fit in memory.
There seem to be problems on multiple levels.
It's not clear that the related entities loaded by _modelAttributes() are ever made accessible. (In my reading of the code, they're assigned to the related variable, but aren't passed back to the caller.
The loading of related entities in ``_modelAttributes()` isn't restricted to the displayed attributes. It tries to load all fields with a relation, whether they're in the display list or not.
The text was updated successfully, but these errors were encountered:
Definitely an issue that related record population isn't limited to display attributes or available for explicit restriction. I'd probably rename this issue "EditController unnecessarily populates related attribute instances for non-display attributes"
Related entries are used to show dropdowns on the edit screen (e.g. src/templates/form-inputs/web-form-input-related.ejs), they are filled in as .instances at the bottom of _modelAttributes.
This code is crufty from a long series of additions so there's plenty of possible refactors. Least change would appear to be to filter related as we do attrs to limit it to display fields here: https://github.com/nxus/web/blob/master/src/ViewController.js#L258 slightly more forward looking would be to add an option parameter to the class to specify specifically which attributes to populate instances for (defaulting to all), in case you want to "display" GeoRegions but not pay this get-them-all cost.
In
EditController
, the_edit()
method callsdefaultContext()
with therelated
parameter set totrue
, which eventually causes_modelAttributes()
to try to load related fields.For cc-assess Project instances, this unfortunately produces a Waterline
find()
operation that tries to load all theGeoRegion
instances, which is a bad thing – they won't fit in memory.There seem to be problems on multiple levels.
It's not clear that the related entities loaded by
_modelAttributes()
are ever made accessible. (In my reading of the code, they're assigned to therelated
variable, but aren't passed back to the caller.The loading of related entities in ``_modelAttributes()` isn't restricted to the displayed attributes. It tries to load all fields with a relation, whether they're in the display list or not.
The text was updated successfully, but these errors were encountered: