Closed jonatkins closed 11 years ago
Could do both. A function that lazy loads and stores if it's needed again.
I started looking at this - and there's several places that take a portal.options.details (i.e. the server data structure) and expect to find the linkedFields within it - so perhaps we will need to add it back there rather than elsewhere. Could shallow-copy the data to avoid tainting the cached values.
I had spotted this property when rewriting the code, and was sure I checked and found it wasn't used in IITC core or any of the standard plugins. I guess i mis-typed the 'grep' pattern...
i just added the data back in the place the existing code expects
I have plans to improve portal data handling further, but that can come later.
As part of my big rewrite of the data loading code, the portal field count is no longer working.
Before this change, IITC used to store these linked fields by modifying the portal.options.details.portalV2, adding a linkedFields property.
This seems wrong. Firstly, the portal.options.details is a reference to the same data stored in the data cache, so shouldn't be modified. Secondly, I'm not sure if it was ever kept up to date correctly - such updates would seem error-prone.
I suggest either a function that takes the options.details and returns the count (by looping through window.fields), or or calculating it once and storing it directly in the portal options (and not within the options.details property)