Skip to content

Diffing issues #1

Description

@tuhuynh27

Array rendering re-paint if append elements to head

Render function:

<ul>
  <li each="todo in state.todos">{{ todo }}</li>
</ul>

Unshift on array state will cause repaint entire the <ul> div:

function addTodo() {
    state.todos.unshift(state.text)
    state.text = ''
}

The same will happen for state.todo[1] = 'Text' and any other operations on array state.

How to solve: Use key for each item, improve the diff for arrays

Metadata

Metadata

Labels

help wantedExtra attention is needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions