Replies: 1 comment
-
This is no longer reproduced after updating to 0.0.90 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Question: Does useThreadHistory work as expected?
Hello everyone,
I've encountered some unexpected behavior with the React hook useStream when its options are updated. This raises the question: Is useThreadHistory functioning correctly in this case?
Background
It appears that when useStream options change (such as apiKey or defaultHeaders), requests like
/threads
and/threads/{id}/runs/stream
correctly reflect the new values. However, the request to/threads/{id}/runs/history
does not seem to react to these updates.Looking into the source code for useThreadHistory, it seems that history is re-fetched only when the threadId changes. Other option changes (e.g., a new Client instance due to updated options) do not trigger a reload.
So, my question is: Is this intentional?
If so, what was the reasoning behind excluding useThreadHistory from reacting to changes in options passed to useStream (which effectively result in a new Client instance)?
Additional Context
I came across this related issue, but the suggested solution doesn’t apply in my case — I'm using useStream within a React context.
Here’s the scenario:
Users authenticate with their own API keys, allowing us to identify them individually on the LangGraph server (and route them to the correct agent). We wait for user data before initializing useStream with the necessary options and then send messages. In this flow, only the
/history
endpoint fails to respect the updated options, resulting in an access error.Code Example
Here’s a simplified code example from our context provider:
Dependencies
Any clarification or guidance would be appreciated. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions