fix: properly detect analytics API success to prevent duplicate events#452
fix: properly detect analytics API success to prevent duplicate events#452henyaGreenberg wants to merge 1 commit into
Conversation
The API returns {status: 200, message: 'success'} but the code was checking result.success which was undefined. This caused sentEvents.add() to never execute, breaking the duplicate prevention mechanism and allowing multiple page_view events with the same flowId to be sent to the database.
There was a problem hiding this comment.
Pull request overview
This PR fixes a critical bug in the analytics event tracking system where duplicate prevention was not working. The issue was caused by checking a non-existent result.success property instead of properly validating the API response structure (status: 200, message: 'success'), which prevented the deduplication mechanism from recording sent events.
Changes:
- Updated success detection logic to check the actual API response structure (
result.status === 200 && result.message === 'success')
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
kalfada
left a comment
There was a problem hiding this comment.
I don't see how it would solve the double event problem, but it wouldn't brake anything
NoamMK
left a comment
There was a problem hiding this comment.
I don't see how it can help
|
@henyaGreenberg , unless you still think it's needed (then explain why) - please close this PR. |
The API returns {status: 200, message: 'success'} but the code was checking result.success which was undefined. This caused sentEvents.add() to never execute, breaking the duplicate prevention mechanism and allowing multiple page_view events with the same flowId to be sent to the database.