Fix: Hide the server select panel, not just the select, if no or only one server is present (#1374)

* fix(packages/openapi): only show server select panel if servers exist

* Create spotty-buckets-nail.md

---------

Co-authored-by: Michael Ermer <[email protected]>
This commit is contained in:
Michael Ermer
2025-02-05 19:15:47 +08:00
committed by GitHub
co-authored by Michael Ermer
parent 33d47f7a30
commit ff9bf0f7df
2 changed files with 11 additions and 4 deletions
+5
View File
@@ -0,0 +1,5 @@
---
"fumadocs-openapi": patch
---
Fix: Hide the server select panel, not just the select, if no or only one server is present
+6 -4
View File
@@ -106,7 +106,7 @@ export function APIPlayground({
ResultDisplay: FC<{ data: FetchResult }>;
}>;
} & HTMLAttributes<HTMLFormElement>) {
const { serverRef } = useApiContext();
const { serverRef, servers } = useApiContext();
const dynamicRef = useRef(new Map<string, DynamicField>());
const form = useForm<FormValues>({
defaultValues: {
@@ -244,9 +244,11 @@ export function APIPlayground({
route={route}
isLoading={testQuery.isLoading}
/>
<CollapsiblePanel title="Server URL">
<ServerSelect />
</CollapsiblePanel>
{servers.length > 1 ? (
<CollapsiblePanel title="Server URL">
<ServerSelect />
</CollapsiblePanel>
) : null}
{header.length > 0 || authorization ? (
<CollapsiblePanel title="Headers">