LearnNewsExamplesServices
Frontmatter
id5050
titlecontainer.Base: object based items
stateClosed
labels
enhancementdiscussionstale
assignees[]
createdAtOct 23, 2023, 3:10 PM
updatedAtSep 13, 2024, 4:28 AM
githubUrlhttps://github.com/neomjs/neo/issues/5050
authortobiu
commentsCount2
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtSep 13, 2024, 4:28 AM

container.Base: object based items

Closed v8.1.0 enhancementdiscussionstale
tobiu
tobiu commented on Oct 23, 2023, 3:10 PM

@ExtAnimal's approach to optionally use objects is charming, since we can enhance configurations via deep merges => only changing the parts we like to.

Current limitations: afterSetItems() will transform the object into the old array based structure right away.

  1. We can only statically enhance item objects.
  2. We are losing the original definition on instance level (well, we can still look at it inside the originalConfig / prototype)
  3. We can not use other afterSet() hooks to further enhance / change object based item definitions
  4. It might not be clear for devs, that the hooks will already always get the items array

One strategy to keep the API consistent would be to use a new config like itemsObject. afterSetItemsObject() could do the transformation and store the result inside the real items config. This way, we could change the itemsObject at run-time. However, the transformation logic needs to be smart. Regenerating the array is not expensive, but re-creating existing item instances must not happen (this can become very expensive).

Thoughts?

tobiu added the enhancement label on Oct 23, 2023, 3:10 PM
tobiu added the discussion label on Oct 23, 2023, 3:10 PM