Skip to content

Commit e8ef803

Browse files
authored
fix(loader): adjust cache keys of getRoot (#4716)
Fixes FER- ## Short description of the changes made ## What was the motivation & context behind this PR? ## How has this PR been tested?
1 parent c4c789c commit e8ef803

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/commons/docs-loader/src/readonly-docs-loader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,7 +550,7 @@ const unsafe_getRootCached = (cacheConfig: Required<CacheConfig>) =>
550550

551551
return root;
552552
},
553-
["unsafe_getRoot", cacheConfig.cacheKeySuffix],
553+
["unsafe_getRoot", domainKey, cacheConfig.cacheKeySuffix],
554554
{ tags: [domainKey, "unsafe_getRoot"] }
555555
)(domainKey);
556556
});

packages/fern-dashboard/src/components/docs-page/GoToEditorButton.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { constructEditorSlug, generateBranchName, ROOT_SLUG_ALIAS } from "@fern-
55

66
import { Loader2, Plus } from "lucide-react";
77
import Link from "next/link";
8-
import { useMemo, useState } from "react";
8+
import { useEffect, useMemo, useState } from "react";
99

1010
import { useOrgName } from "@/app/[orgName]/context/OrgNameContext";
1111
import 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

Comments
 (0)