(state: HistoryState | null)
| 46 | } |
| 47 | |
| 48 | function restoreScrollPosition(state: HistoryState | null) { |
| 49 | if (state?.scrollTop != null || state?.windowScrollTop != null) { |
| 50 | requestAnimationFrame(() => { |
| 51 | let scrollContainer = getScrollContainer(); |
| 52 | if (scrollContainer && state.scrollTop != null) { |
| 53 | scrollContainer.scrollTop = state.scrollTop; |
| 54 | } |
| 55 | if (state.windowScrollTop != null) { |
| 56 | window.scrollTo(0, state.windowScrollTop); |
| 57 | } |
| 58 | }); |
| 59 | } |
| 60 | } |
| 61 | |
| 62 | // A very simple router. When we navigate, we'll fetch a new RSC payload from the server, |
| 63 | // and in a React transition, stream in the new page. Once complete, we'll pushState to |
no test coverage detected