diff --git a/examples/vite-app/src/App/index.tsx b/examples/vite-app/src/App/index.tsx index fabbd853..0ec2a021 100644 --- a/examples/vite-app/src/App/index.tsx +++ b/examples/vite-app/src/App/index.tsx @@ -54,6 +54,11 @@ const routes: IRoute[] = [ path: '/backgrounds', component: Backgrounds, }, + { + name: 'Cancel Connection', + path: '/cancel-connection', + component: CancelConnection, + }, { name: 'Controlled/Uncontrolled', path: '/controlled-uncontrolled', @@ -214,21 +219,17 @@ const routes: IRoute[] = [ path: '/use-key-press', component: UseKeyPress, }, - { - path: '/cancel-connection', - component: CancelConnection - } ]; const Header = () => { const location = useLocation(); const navigate = useNavigate(); const [currentPath, setCurrentPath] = useState(location.pathname); - + useEffect(() => { const name = routes.find((route) => route.path === currentPath)?.name; document.title = `React Flow Examples${name ? ' - ' + name : ''}`; - navigate(currentPath) + navigate(currentPath); }, [currentPath]); return ( @@ -236,10 +237,7 @@ const Header = () => { React Flow Dev - setCurrentPath(event.target.value)}> {routes.map((route) => (