Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diffing issues #1

Open
tuhuynh27 opened this issue Dec 9, 2020 · 1 comment · Fixed by #2
Open

Diffing issues #1

tuhuynh27 opened this issue Dec 9, 2020 · 1 comment · Fixed by #2
Assignees
Labels
help wanted Extra attention is needed

Comments

@tuhuynh27
Copy link
Member

tuhuynh27 commented Dec 9, 2020

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 tuhuynh27 added the help wanted Extra attention is needed label Dec 9, 2020
@tuhuynh27 tuhuynh27 reopened this Dec 9, 2020
@tuhuynh27
Copy link
Member Author

Still need to handle the array's keys

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants