A brand-new chat (activeChatId === null) had no way to learn the id of the row the server created: the SSE stream never returned it, so the client adopted the NEWEST chat in the per-user list (chats.items[0]). With two tabs open, a second tab creating a chat at ~the same time made its row the newest, so the first tab adopted the wrong id — its later turns persisted into the other chat and the agent rebuilt history from it (commands leaked between chats), while the live UI still showed the original conversation. (#137) The server now attaches the authoritative chatId to the streamed assistant message via the AI SDK messageMetadata on the 'start' part, so it reaches the client on the first chunk. The client reads message.metadata.chatId in useChat's onFinish and adopts that id in place (no remount, so the live turn and the thread's chatIdRef follow the real id and the next turn targets the right chat). The chats.items[0] guess and the adoptNewChat ref are removed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
A progressive Node.js framework for building efficient and scalable server-side applications.
Description
Nest framework TypeScript starter repository.
Installation
$ npm install
Running the app
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
Migrations
# This creates a new empty migration file named 'init'
$ npm run migration:create --name=init
# Generates 'init' migration file from existing entities to update the database schema
$ npm run migration:generate --name=init
# Runs all pending migrations to update the database schema
$ npm run migration:run
# Reverts the last executed migration
$ npm run migration:revert
# Reverts all migrations
$ npm run migration:revert
# Shows the list of executed and pending migrations
$ npm run migration:show
## Test
```bash
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
Support
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
Stay in touch
- Author - Kamil Myśliwiec
- Website - https://nestjs.com
- Twitter - @nestframework
License
Nest is MIT licensed.