[fluxible-router] replaceState always updates <title> on scroll
alexparish opened this issue · 8 comments
Is there a reason History.js is set up to always update the title on scroll?
It seems unperformant to update the DOM any time the user scrolls the page.
There could be a good reason for this but unfortunately I'm unfamiliar with the project.
@alexparish looking at the code, where do you see this being added on scroll?
https://github.com/yahoo/fluxible/blob/master/packages/fluxible-router/lib/handleHistory.js#L136
_saveScrollPosition
is called following a timeout and the title is finally updated here: https://github.com/yahoo/fluxible/blob/master/packages/fluxible-router/lib/History.js#L141
I see now, thanks. I agree that the title probably doesn't need to be updated each time. We could check if the title is the same before changing it or have some flag that prevents it from happening. Are you seeing performance issues because of this?
/cc @lingyan
Scrolling is sometimes janky in our app but I can't definitively associate it to the title updates.
Checking if the title is the same before updating would be great to avoid a DOM update.
@alexparish want to PR it?
Sure! Am on it.
@alexparish this is now published in fluxible-router@1.0.1. Thanks again!
Awesome, thank you!