Skip to content

Commit be33cbb

Browse files
committed
update changesets
1 parent 0cac7df commit be33cbb

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

.changeset/openapi-storage-key-isolation.md

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,19 @@
22
'fumadocs-openapi': minor
33
---
44

5-
Add `storageKey` option to isolate localStorage for multiple API instances
5+
Add `storageKeyPrefix` option to isolate `localStorage` for multiple API instances
66

7-
When using multiple `createOpenAPI()` instances in the same application, the server selection state would bleed between different APIs because they all shared the same hardcoded `'apiBaseUrl'` localStorage key.
8-
9-
**Changes:**
10-
- Added `storageKey` parameter to `OpenAPIOptions` and `CreateAPIPageOptions` interfaces
11-
- Updated `ApiProvider` to accept and use custom storage keys
12-
- Defaults to `'apiBaseUrl'` for backward compatibility
7+
When using multiple `createOpenAPI()` instances in the same application, the server selection state would bleed between different APIs because they all shared the same storage key prefix.
8+
Set a prefix to avoid this.
139

1410
**Usage:**
15-
```typescript
16-
export const dataApi = createOpenAPI({
17-
input: ['./openapi/data.json'],
18-
storageKey: 'apiBaseUrl-data',
19-
});
2011

21-
export const metricsApi = createOpenAPI({
22-
input: ['./openapi/metrics.json'],
23-
storageKey: 'apiBaseUrl-metrics',
12+
```tsx
13+
// components/api-page.client.tsx
14+
'use client';
15+
import { defineClientConfig } from 'fumadocs-openapi/ui/client';
16+
17+
export default defineClientConfig({
18+
storageKeyPrefix: 'fumadocs-openapi-custom-',
2419
});
2520
```
26-
27-
Each API instance now maintains independent server selection state.
28-

0 commit comments

Comments
 (0)