From 3ed961e5435bf12e8b5220ae99b797311d5fb64e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dafydd=20Ll=C5=B7r=20Pearson?= Date: Wed, 20 Nov 2024 10:55:16 +0000 Subject: [PATCH] fix: Only scroll to start node on initial load of flow --- .../pages/FlowEditor/components/Flow/components/EndPoint.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/EndPoint.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/EndPoint.tsx index 79eedefd4a..7ae4691bf0 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/EndPoint.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Flow/components/EndPoint.tsx @@ -19,6 +19,11 @@ const EndPoint: React.FC<{ text: string }> = ({ text }) => { useEffect(() => { if (isStart && el.current) { + // Only scroll to center on initial visit + const storageKey = ["scrollPos", currentPath].join(":"); + const hasVisited = sessionStorage.getItem(storageKey); + if (hasVisited) return; + if (isLoading) return; scrollIntoView(