Addresses the PR #138 review. Blocker 1 — duplicate chat row: a brand-new chat whose first turn errors BEFORE the SSE 'start' chunk never receives the authoritative chatId, so metadata adoption can't run; a retry then sent chatId:null and the server inserted a SECOND chat row, orphaning the first turn. Keep metadata adoption as the primary path (resolveAdoptedChatId) and add a bounded, unambiguous fallback: on a new-chat finish with no server id, snapshot the known chat ids and, once the list refetch lands, adopt the SINGLE newly-appeared id (pickNewlyCreatedChatId). Zero or >1 new ids (e.g. two tabs racing) → no adoption — no items[0] guessing, so #137 stays fixed. The wait-for-refetch guard compares set membership (robust to a concurrent delete), and the diff dedupes so a repeated id from a paginated list never reads as ambiguous. Blocker 2 — tests: new adopt-chat-id.test.ts covers both pure helpers (adopt decision + newly-created-id diff incl. dedupe/reorder); the server messageMetadata callback is extracted to chatStreamStartMetadata and unit-tested (start -> {chatId}, otherwise undefined). 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