inertia
inertia copied to clipboard
Restore scroll position inside setPage
This is a proposed fix for #1211
This change will ensure that whenever setPage is called, the preserveScroll option is respected. Since this option is always passed from current callers to setPage anyway, it should be safe to move the handling to setPage. This will centralize preserveScroll handling when using setPage. There are a few other instances where scroll needs to be restored, which does not involve calling setPage, and this PR does not affect them.
Alternatively, we could add a promise resolved handler here, and call restoreScrollPositions(), but it seems redundant.