@@ -5,7 +5,7 @@ import { constructEditorSlug, generateBranchName, ROOT_SLUG_ALIAS } from "@fern-
55
66import { Loader2 , Plus } from "lucide-react" ;
77import Link from "next/link" ;
8- import { useMemo , useState } from "react" ;
8+ import { useEffect , useMemo , useState } from "react" ;
99
1010import { useOrgName } from "@/app/[orgName]/context/OrgNameContext" ;
1111import type { Auth0SessionData } from "@/app/services/auth0/getCurrentSession" ;
@@ -42,11 +42,7 @@ export function GoToEditorButton({
4242 } ) ;
4343 } , [ orgName , docsUrl , newBranchName ] ) ;
4444
45- const handleClick = ( ) => {
46- setIsLoading ( true ) ;
47-
48- // Preload editor data to warm the cache before navigation
49- // Fire and forget - don't block navigation on this
45+ useEffect ( ( ) => {
5046 void preloadEditorData ( {
5147 docsUrl : encodeURIComponent ( docsUrl ) as EncodedDocsUrl ,
5248 host : window . location . host ,
@@ -55,6 +51,10 @@ export function GoToEditorButton({
5551 // Log error but don't block navigation
5652 console . error ( "Failed to preload editor data:" , error ) ;
5753 } ) ;
54+ } , [ docsUrl , newBranchName ] ) ;
55+
56+ const handleClick = ( ) => {
57+ setIsLoading ( true ) ;
5858 } ;
5959
6060 return (
0 commit comments