fix(samples): filter out heartbeat messages from webhook stream UI#198
fix(samples): filter out heartbeat messages from webhook stream UI#198pengying wants to merge 1 commit into02-12-feat_adding_typescript_samplefrom
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Greptile SummaryThis PR filters out heartbeat messages from the SSE webhook stream in the Key changes:
The implementation correctly achieves its stated goal. One minor issue: the catch block's comment mentions "heartbeats" but these are already filtered by the guard on line 23, making the comment slightly misleading. Confidence Score: 4/5
Last reviewed commit: 8bb2c10 |
62f02be to
bb08f69
Compare
39d7789 to
5dc3954
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
bb08f69 to
dd4347f
Compare
5dc3954 to
8bb2c10
Compare
| } catch { | ||
| setEvents((prev) => [{ | ||
| timestamp: Date.now(), | ||
| type: 'raw', | ||
| raw: event.data | ||
| }, ...prev]) | ||
| // Skip non-JSON messages (heartbeats, etc.) | ||
| } |
There was a problem hiding this comment.
The comment mentions "heartbeats" but they are already filtered by the raw === 'heartbeat' check on line 23, so they never reach this catch block. Consider updating the comment to clarify:
| } catch { | |
| setEvents((prev) => [{ | |
| timestamp: Date.now(), | |
| type: 'raw', | |
| raw: event.data | |
| }, ...prev]) | |
| // Skip non-JSON messages (heartbeats, etc.) | |
| } | |
| } catch { | |
| // Discard unparseable SSE frames | |
| } |
Prompt To Fix With AI
This is a comment left during a code review.
Path: samples/frontend/src/components/WebhookStream.tsx
Line: 32-34
Comment:
The comment mentions "heartbeats" but they are already filtered by the `raw === 'heartbeat'` check on line 23, so they never reach this catch block. Consider updating the comment to clarify:
```suggestion
} catch {
// Discard unparseable SSE frames
}
```
How can I resolve this? If you propose a fix, please make it concise.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com
Ignore heartbeat messages in the webhook stream event handler to prevent them from being processed as regular webhook events.