Fix scroll restore on refresh, add CLAUDE.md bundle compile directive
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -682,8 +682,15 @@ class Spa {
|
||||
window.scrollTo({ left: opts.scroll.x, top: opts.scroll.y, behavior: 'instant' });
|
||||
} else if (opts.scroll === undefined) {
|
||||
// Default: scroll to top for new navigation (only if scroll not explicitly set)
|
||||
console_debug('Spa', 'Scrolling to top (new navigation)');
|
||||
window.scrollTo({ left: 0, top: 0, behavior: 'instant' });
|
||||
// BUT skip on page reload - let Rsx._restore_scroll_on_refresh handle it
|
||||
const nav_entries = performance.getEntriesByType('navigation');
|
||||
const is_reload = nav_entries.length > 0 && nav_entries[0].type === 'reload';
|
||||
if (is_reload) {
|
||||
console_debug('Spa', 'Skipping scroll-to-top on page reload (Rsx handles refresh scroll restore)');
|
||||
} else {
|
||||
console_debug('Spa', 'Scrolling to top (new navigation)');
|
||||
window.scrollTo({ left: 0, top: 0, behavior: 'instant' });
|
||||
}
|
||||
}
|
||||
// If opts.scroll === null, don't scroll (let Navigation API or browser handle it)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user