A brand-new chat's first turn streamed and finished successfully, but the whole assistant response vanished from the UI. On finish the window adopts the server-created chat id, which changed the <ChatThread> key and remounted it — discarding the live useChat store (the full answer) and re-seeding from not-yet-persisted history, so only the user message remained. - chat-thread: pin the useChat store id to a per-mount value so adopting the chatId prop no longer recreates the store and wipes the live turn. - ai-chat-window: derive the thread mount key via setState-during-render and move the live-thread marker in lockstep with the adopted id, so in-place adoption keeps the same mounted thread while real chat switches still remount and re-seed; gate the history loader to a freshly opened chat. - cancel a pending adoption on New chat / explicit chat selection. - log the raw stream error to the browser console for debugging. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level
parserOptionsproperty like this:
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module',
project: ['./tsconfig.json', './tsconfig.node.json'],
tsconfigRootDir: __dirname,
},
- Replace
plugin:@typescript-eslint/recommendedtoplugin:@typescript-eslint/recommended-type-checkedorplugin:@typescript-eslint/strict-type-checked - Optionally add
plugin:@typescript-eslint/stylistic-type-checked - Install eslint-plugin-react and add
plugin:react/recommended&plugin:react/jsx-runtimeto theextendslist