feat: add API to pause scroll position saving#306
Conversation
|
I'm really sorry for the delay here. We've been swamped at work lately. I'll take a look by early next week. Unfortunately probably not this weekend |
|
No problem, thanks for you help so far - I'll be grateful if you can have a look soon. I'd like to make the tests cover his change but it looks like that would require a bit of surgery on he test setup - to make it call |
|
can you merge with master to avoid the conflicts with your other PR? |
9d238b0 to
52e719f
Compare
|
conflict fixed |
|
any chance of getting to this soon? |
52e719f to
804f14d
Compare
|
sorry, i've been really swamped. i'll look by end of week |
|
Besides implementing your suggestion for the API, I also added tests (which was easier with this API), and in the process fixed a bug that prevented this feature from working for custom elements. I think it's ready now. |
|
published to v0.9.11 |
|
thanks for your help here – sorry for the delay |
|
No worries, thankyou! |
Now that taion/scroll-behavior#306 has been merged, this updates the dependency to the released version, including using the modified API that resulted from the review feedback. Fixes #69
In Rudy it is possible that
updateScrollis not called immediately after a transition (rather it might occur asynchronously afterwards).Further, the content of the new route might not be rendered immediately. for example, the following things might happen
updateScrollis called to restore the scroll position on the new routeSometimes, scroll events happen at steps 3 or 5, because the page content height reduces such that it is lower than the current
window.scrollYvalue. In this case, it is not desired to save the scroll position, because it is just noise occurring during the transition.This adds a flag
_isTransitioningwhich is used to skip saving the scroll position in between calls to the transition hook andupdateScroll. The assumption is thatupdateScrollis always called after every transition.