LearnNewsExamplesServices
Frontmatter
id3116
titlevdom.Helper: createDeltas() => enhance the logic for re-sorting arrays
stateClosed
labels
enhancement
assigneestobiu
createdAtMay 30, 2022, 10:13 PM
updatedAtMay 30, 2022, 10:16 PM
githubUrlhttps://github.com/neomjs/neo/issues/3116
authortobiu
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtMay 30, 2022, 10:16 PM

vdom.Helper: createDeltas() => enhance the logic for re-sorting arrays

Closed v8.1.0 enhancement
tobiu
tobiu commented on May 30, 2022, 10:13 PM

This item is tricky, since there are many edge cases to be aware of.

In case we re-sort an array and some items stay at the "same" index, the vdom engine does not think that there is a need for a change. However, in case we add or remove items in front of an array item which should stay at the same index, it can interfere with items which get moved as well, leading to a broken order.

We want to achieve:

  1. An array of items which does not get any index changes should not get any deltas
  2. vdom.cn.unshift(vdom.cn.pop()); should only create one delta.
  3. The resulting order has to be correct, even in case some items stay at the same index.
  4. The amount of move OPs (deltas) needs to be minimal.

I think we can do this with just one line of magic :)

tobiu added the enhancement label on May 30, 2022, 10:13 PM
tobiu assigned to @tobiu on May 30, 2022, 10:13 PM
tobiu referenced in commit be46754 - "vdom.Helper: createDeltas() => enhance the logic for re-sorting arrays #3116" on May 30, 2022, 10:14 PM
tobiu closed this issue on May 30, 2022, 10:16 PM