MCPcopy Create free account
hub / github.com/dailydotdev/apps / restore

Function restore

packages/shared/src/lib/scrollRestoration.ts:93–109  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91 };
92
93 const restore = () => {
94 if (stopped) {
95 return;
96 }
97 if (getHistoryEntryKey() !== scrollKey) {
98 stop();
99 return;
100 }
101
102 const maxScroll =
103 document.documentElement.scrollHeight - window.innerHeight;
104 if (maxScroll >= target) {
105 window.scrollTo(0, target);
106 expectShellScroll(target);
107 stop();
108 }
109 };
110
111 const scheduleRestore = () => {
112 cancelAnimationFrame(frame);

Callers 1

restoreScrollPositionFunction · 0.70

Calls 3

expectShellScrollFunction · 0.90
getHistoryEntryKeyFunction · 0.70
stopFunction · 0.70

Tested by

no test coverage detected