[PR #5208] Allow React useStream client changes for thread/{id}/history requests #4299

Closed
opened 2026-02-20 17:49:58 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langchain-ai/langgraph/pull/5208

State: closed
Merged: No


Update the useThreadHistory logic to respond to stream client change

Problem definition

The useStream is a React hook that should react to component rerenders (ex, state changes).

React useStream encapsulates multiple calls, like /threads, /threads/{id}/runs/stream, /threads/{id}/runs/history.

First and second endpoints respond to options changes (defaultHeaders and apiKey in my case), but /threads/{id}/runs/history is not. Even if threadId is changed, new option changes are unavailable at the history level.
I hope this fix will solve this behavior

This fix is working on my local machine, but I'm not sure if the stable history client is a necessary logic. If it is true, I'd like to see a reason description in the code or the docs. The actual example section in documentation doesn't respond to my question.


References

I'm not sure that it is a bug, so I prepared discussion. It includes more description about my case.

I found a similar issue to this behavior: https://github.com/langchain-ai/langgraph/issues/4596

**Original Pull Request:** https://github.com/langchain-ai/langgraph/pull/5208 **State:** closed **Merged:** No --- # Update the useThreadHistory logic to respond to stream client change ## Problem definition The useStream is a React hook that should react to component rerenders (ex, state changes). React useStream encapsulates multiple calls, like `/threads`, `/threads/{id}/runs/stream`, `/threads/{id}/runs/history`. First and second endpoints respond to options changes (defaultHeaders and apiKey in my case), but `/threads/{id}/runs/history` is not. Even if threadId is changed, new option changes are unavailable at the history level. I hope this fix will solve this behavior This fix is working on my local machine, but I'm not sure if the stable history client is a necessary logic. If it is true, I'd like to see a reason description in the code or the docs. The actual [example section in documentation](https://langchain-ai.github.io/langgraph/cloud/how-tos/use_stream_react/#example) doesn't respond to my question. --- ## References I'm not sure that it is a bug, so I prepared [discussion](https://github.com/langchain-ai/langgraph/discussions/5202). It includes more description about my case. I found a similar issue to this behavior: https://github.com/langchain-ai/langgraph/issues/4596
yindo added the pull-request label 2026-02-20 17:49:58 -05:00
yindo closed this issue 2026-02-20 17:49:59 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraph#4299