You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, using scrollBehavior adds a scroll listener to record window.pageXOffset and window.pageYOffset, which will force the browser into doing layout+repaint when scrolling, resulting in serious scrolling janks on mobile devices.
Since we cannot avoid accessing pageXOffset and pageYOffset, here are some improvements I can think of:
Implement a simple debounce function for the scroll listener, and add a scrollListenerDebounce option to router configs, which defaults to 1000ms. This should make accessing pageXOffset and pageYOffset only when the user have stopped scrolling for 1000ms.
Add a section in the docs explaining the potential performance issues when using scrollBehavior, and the inaccuracy of the recorded scrolling position, caused by the debounce function
The text was updated successfully, but these errors were encountered:
Currently, using
scrollBehavior
adds a scroll listener to recordwindow.pageXOffset
andwindow.pageYOffset
, which will force the browser into doing layout+repaint when scrolling, resulting in serious scrolling janks on mobile devices.Since we cannot avoid accessing
pageXOffset
andpageYOffset
, here are some improvements I can think of:scrollListenerDebounce
option to router configs, which defaults to 1000ms. This should make accessingpageXOffset
andpageYOffset
only when the user have stopped scrolling for 1000ms.scrollBehavior
, and the inaccuracy of the recorded scrolling position, caused by the debounce functionThe text was updated successfully, but these errors were encountered: