Commit 47a7abd
feat(react): add useEventStream hook for consuming PerstackEvent streams
Add a new useEventStream hook that provides automatic connection management
for PerstackEvent streams. The hook is API-agnostic and accepts an
EventSourceFactory function, allowing it to work with any backend.
Features:
- Automatic connection lifecycle management
- Event processing through useRun hook internally
- Connection state tracking (isConnected, error)
- Proper cleanup on unmount or when disabled
- AbortSignal support for stream cancellation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent f8eff15 commit 47a7abd
File tree
5 files changed
+541
-0
lines changed- .changeset
- packages/react/src
- hooks
5 files changed
+541
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
1 | 8 | | |
2 | 9 | | |
0 commit comments