mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-31 12:19:58 +02:00
Add optional newThreadId parameter to useStream hook that allows specifying a thread ID for new thread creation while keeping threadId null. This enables optimistic UI patterns where developers need to know the thread ID beforehand for routing/navigation without causing 404 errors from attempting to fetch non-existent thread history. Usage: - Set threadId: null and newThreadId: "predetermined-id" - Submit message to create thread with specified ID - Use onThreadId callback to update threadId after creation This solves the UX problem of having to await thread creation before enabling optimistic navigation to e.g. /[threadId] routes.