Summary
When the url argument changes, useSSE in packages/data/src/hooks/useSSE.ts opens a new EventSource, but it does not reset data, error, or loading before the new stream receives its first message.
Reproduction
- Subscribe to stream A and receive a message.
- Re-render with stream B.
- Before stream B emits its first message, read the hook state.
Expected behavior
Changing url should put the hook back into a fresh loading state and avoid showing data from the previous stream as if it came from the new stream.
Actual behavior
The previous stream's last data value remains visible and loading can remain alse until the new stream emits or errors.
Summary
When the url argument changes, useSSE in packages/data/src/hooks/useSSE.ts opens a new EventSource, but it does not reset data, error, or loading before the new stream receives its first message.
Reproduction
Expected behavior
Changing url should put the hook back into a fresh loading state and avoid showing data from the previous stream as if it came from the new stream.
Actual behavior
The previous stream's last data value remains visible and loading can remain alse until the new stream emits or errors.