OpenAPI: fix hydration errors

This commit is contained in:
Fuma Nama
2026-05-09 16:30:59 +08:00
parent 3e06c10f0a
commit e89fd74ebc
3 changed files with 13 additions and 7 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'fumadocs-openapi': patch
---
fix hydration errors
@@ -80,10 +80,9 @@ export function UsageTab({
const code = useMemo(() => {
if (!data) return;
const url = joinURL(
withBase(
server ? resolveServerUrl(server.url, server.variables) : '/',
typeof window !== 'undefined' ? window.location.origin : 'https://loading',
),
server && typeof window !== 'undefined'
? withBase(resolveServerUrl(server.url, server.variables), window.location.origin)
: 'https://example.com',
resolveRequestData(route, data),
);
@@ -197,14 +197,16 @@ export function createAutoPreset(options: SchemaToPagesOptions): PagesBuilderCon
}
for (const tag of tags) {
const res = builder.fromTagName(tag);
if (!res) continue;
const groupName = slugify(tag);
const { displayName, info } = builder.fromTagName(tag)!;
let group = groups.get(groupName);
if (!group) {
group = {
type: 'group',
info: { title: displayName, description: info.description },
tag: info,
info: { title: res.displayName, description: res.info.description },
tag: res.info,
entries: [],
schemaId: builder.id,
path: groupName,