fix(editor): scroll to top on mount instead of restoring prior position
Navigating to /editor (either from /new or by re-importing a PDF) landed the user at the bottom of the page because the browser restored its previous scroll position on a long route. Force a one-shot scroll to (0,0) on mount with an empty-deps effect so the report opens at the header. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
06a22aec11
commit
1b01744efc
1 file changed
+4
@@ -105,6 +105,10 @@ export default function EditorRoute() {
|
||||
if (!report) navigate('/')
|
||||
}, [report, navigate])
|
||||
|
||||
useEffect(() => {
|
||||
window.scrollTo({ top: 0, left: 0, behavior: 'auto' })
|
||||
}, [])
|
||||
|
||||
const species = useMemo(
|
||||
() => (report ? getSpecies(report.animal.speciesId) : undefined),
|
||||
[report],
|
||||
|
||||
Reference in new issue
Block a user