You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/openapi-ts/clients/next-js.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -251,7 +251,9 @@ When your OpenAPI spec defines endpoints with `text/event-stream` responses, the
251
251
252
252
### Consuming a stream
253
253
254
-
SSE requires a client component since it uses browser APIs and React hooks.
254
+
::: tip
255
+
Unlike regular SDK calls which support Next.js caching options (`cache`, `next: { revalidate, tags }`), SSE streams are long-lived connections and must run in client components.
Copy file name to clipboardExpand all lines: docs/openapi-ts/clients/nuxt.md
+17-5Lines changed: 17 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -222,19 +222,30 @@ When your OpenAPI spec defines endpoints with `text/event-stream` responses, the
222
222
223
223
### Consuming a stream
224
224
225
+
::: tip
226
+
SSE endpoints always return `{ stream }` with an `AsyncGenerator`. The `composable` option (`useAsyncData`, `useFetch`, etc.) does not apply to SSE — it is designed for request-response patterns with caching. SSE streams are consumed client-side only.
227
+
:::
228
+
229
+
With the `@hey-api/nuxt` module, SDK functions are auto-imported. Vue refs passed as parameters are automatically unwrapped.
230
+
225
231
```vue
226
232
<script setup lang="ts">
227
233
import { ref, onUnmounted } from 'vue';
228
-
import { watchStockPrices } from './client/sdk.gen';
229
-
import type { StockUpdate } from './client/types.gen';
234
+
// With @hey-api/nuxt, these imports are auto-generated:
235
+
import { watchSingleStock } from '#hey-api/sdk.gen';
236
+
import type { StockUpdate } from '#hey-api/types.gen';
230
237
231
238
const updates = ref<StockUpdate[]>([]);
232
-
const controller = new AbortController();
239
+
const symbol = ref('AAPL');
240
+
let controller: AbortController | null = null;
233
241
234
-
onUnmounted(() => controller.abort());
242
+
onUnmounted(() => controller?.abort());
235
243
236
244
async function connect() {
237
-
const { stream } = await watchStockPrices({
245
+
controller = new AbortController();
246
+
247
+
const { stream } = await watchSingleStock({
248
+
path: { symbol }, // Vue refs are unwrapped automatically
0 commit comments