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

DOM updates are not batched, causing visible flicker #177

Closed
Aivean opened this issue Feb 12, 2021 · 1 comment
Closed

DOM updates are not batched, causing visible flicker #177

Aivean opened this issue Feb 12, 2021 · 1 comment

Comments

@Aivean
Copy link

Aivean commented Feb 12, 2021

Describe the bug

Here is my minimal example: https://gist.github.com/Aivean/f4e7c0b15a860685f2eff7814b1ffa99

It renders a list that can be "navigated" by pressing Up and Down arrows. On a single keypress, next/previous element becomes active and current element becomes inactive.

Demo:
kweb-flicker

Each list element is rendered using render over correctly mapped KVar, and, as could be seen from websocket log, on single keypress only two affected list elements are updated. However, because changes to these two elements are applied one by one, it causes visible flicker (as could be seen on the gif above). I.e. there are rendered browser frames, when changes are applied partially, when one list element is removed, but not yet replaced by the new element.

This is different from how, for example, React + Mobx would behave.

To Reproduce

Run the linked example. Navigate list by pressing Up or Down arrow, observe flicker.

Expected behavior

Dom changes triggered by single KVar change should be batched and applied on the client within a single requestAnimationFrame.

@Derek52
Copy link
Collaborator

Derek52 commented Jun 8, 2021

I just released version 0.10.0 that fixes this issue.

@Derek52 Derek52 closed this as completed Jun 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants