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

transition-group DOM update lag when using css frameworks #5845

Open
neontuna opened this issue Jun 8, 2017 · 8 comments
Open

transition-group DOM update lag when using css frameworks #5845

neontuna opened this issue Jun 8, 2017 · 8 comments

Comments

@neontuna
Copy link

neontuna commented Jun 8, 2017

Version

2.3.3

Reproduction link

http://jsbin.com/fegogus/edit?html,css,js,output

Steps to reproduce

Apply a transition group to v-for when using popular CSS frameworks, most noticeable with Semantic-UI but also apparent with Bootstrap. Example uses table rows but issue also appears with something more simple, such as an unordered list.

What is expected?

Transition group continues to have similar performance as it does without any CSS applied

What is actually happening?

There is a considerable amount of update lag, particularly when changing the v-for array using slice


This obviously walks the line between a VueJS issue and an issue for one of the involved frameworks. I'm opening the case here though as honestly I don't know that anyone on the Semantic-UI side of things would be able to help.

The example is a little more complicated than needed to reproduce the issue simply because I wanted to show my use case - which is animating additions to the array used by v-for but otherwise having no transitions. This is because the table will also be paginated (sliced) or sorted and I don't want to animate that process at all.

In the example you can toggle using a transition-group on and off. Without the transition group the DOM updates instantly as expect. With it turned on, and even without any transition being active, you can see that toggling between sliced and the full array is very slow to update the visible DOM.

Also sorry for submitting this three times, the new issue vue site was doing something goofy in Chrome, had to switch to Safari.

@HerringtonDarkholme
Copy link
Member

It seems to be Chrome only bug. Work fine on Firefox.

@neontuna
Copy link
Author

neontuna commented Jun 8, 2017

I'm still seeing it in Firefox in Windows and macOS. Also tried Chrome Canary and Firefox beta channel. Its really noticeable if you toggle the transition group off and then slice the array using the other button there.

@posva
Copy link
Member

posva commented Jun 8, 2017

Looking a bit more into it. It looks like having a dynamic name for the transition is greatly adding the lag sensation. Setting name="fade" improves a lot.
It looks like something is editing inline styles with too many components while only one should be animated (I may be wrong)

screen shot 2017-06-08 at 16 35 43

@neontuna
Copy link
Author

neontuna commented Jun 9, 2017

I figured the dynamic name was adding to some of the lag, but if you remove name completely, or setup a style without any transition applied, there's still a pretty noticeable pause. This becomes more pronounced with a more complicated v-for. For instance the table in my app has a lot more data and some other functions generating the table and the display lag is a pretty big bummer.

Since I'm not actually interested in animating the entire list I might try to see if there's a way I can just animate the additions without wrapping v-for with a transition group.

@HerringtonDarkholme
Copy link
Member

HerringtonDarkholme commented Jun 14, 2017

My observation is that transition-group enables flip technique by default. However, it requires at least one call to getBoundingClientRect. Source: https://github.com/vuejs/vue/blob/dev/src/platforms/web/runtime/components/transition-group.js#L65.
This forces style recalculation and layout reflow. As the chart show below.

screen shot 2017-06-14 at 10 38 43 am

This is usually cheap with small style sheet, but with a full blown CSS framework recomputing styles is too expensive.

@HerringtonDarkholme
Copy link
Member

I don't think this is fixable in Vue framework, though. I have tried some way to optimize away getBoundingClientRect call but it requires getTransformationInfo which causes style recalculation as well. Since transition-group is designed for FLIP technique, there is little chance we can avoid at least one style recalculation call.

Fairly, the click event listener still respond in about 100ms even for CPU 20X slowdown, which seems acceptable. If the CSS framework adds too many rules, well, then FLIP technique is something you might want to avoid.

@neontuna
Copy link
Author

Thank you for investigating further, that explanation makes sense. Even without any specific classes applied its obvious that Semantic-UI and others are making changes to elements like body, text, etc directly. Thus causing the recalculation load.

@NordBee
Copy link

NordBee commented Aug 3, 2019

I have the same problem with Bulma

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

6 participants