Skip to content

bug(data): useSSE does not reset state when subscribing to a new URL #3758

Description

@Tomeshwari-02

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

  1. Subscribe to stream A and receive a message.
  2. Re-render with stream B.
  3. 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.

Metadata

Metadata

Assignees

Labels

assignedIssue claimed by a contributor.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions