reactif icon indicating copy to clipboard operation
reactif copied to clipboard

Diffing issues

Open tuhuynh27 opened this issue 5 years ago • 1 comments

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

tuhuynh27 avatar Dec 09 '20 09:12 tuhuynh27

Still need to handle the array's keys

tuhuynh27 avatar Dec 09 '20 14:12 tuhuynh27