-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
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
Styles are not updated in time #7707
Comments
seems a regression(or a feature) of 2.5.x internal change |
Likely to be related to https://gist.github.com/yyx990803/9bdff05e5468a60ced06c29c39114c6b#intenrals-change-for-nexttick , which is considered to be a fix. Related issue #6854 . |
I would argue that Vue is not intended to be used for animations by rapidly changing style value bindings. That would have horrible performance in any but the most simple components, because you will re-render the whole component on every scroll event. In my opinion., That should rather be done on the DOM level, i.e. with a custom directive, or with a dedicated animation library for biger things. |
Looks like it's the deferred rerendering triggered by event handler which produces this problem, you can add scroll event listener manually inside |
Link: vue-nextTick In the doc, it shows nextTick's callback will be executed after the next DOM update. |
Currently For most of us one of Vue's best part is that developers wouldn't have to dig into internals to create rather complicated yet performant applications, and “it just works”. |
I think we'll likely revert to always use microtask in 2.6. The change fixed some really niche edge cases but incurs its own quirks like this which are actually more problematic than the ones fixed. |
@yyx990803 any update on this? The lack of a correct/consistent $nextTick is really causing me problems when trying to ensure that the Vue and other non-Vue parts of my UI are updated in the same frame. |
Closed via #8450 (will be out in 2.6) |
Version
2.5.13
Reproduction link
https://github.com/Axure/sticky-scroll-demo
Steps to reproduce
and open
http://localhost:8080
. Scroll inside the region with black border from top to bottom. You will see another div with black border with "text" inside it.What is expected?
The text should always be right on the midline of the visible area of the smaller bordered div.
What is actually happening?
The text is sometimes not on the midline, which produces visible "lags".
You can see wrongly rendered frames in the developer tools, e.g.:
(Note that for clarity I temporarily set a red border for the div of the text.)
An online demo is available at https://axure.github.io/sticky-scroll-demo/.
The effect is achieved by modifying the
translateY
of the text inside the smaller div on every scroll. It seems that the modified styled is not applied in time, so the a newly scrolled frame is rendered using the old style.I highly suspect that not only styles, but also other data are not applied in time in possible scenarios.
It is not a problem of the browser, since the raw DOM solution works well:
Angular and React do not suffer from this problem:
The text was updated successfully, but these errors were encountered: