Skip to content

feat(cdp): warn about event drop when returning null or undefined#30268

Merged
meikelmosby merged 4 commits intomasterfrom
feat/meikel/warn-about-event-drop
Mar 24, 2025
Merged

feat(cdp): warn about event drop when returning null or undefined#30268
meikelmosby merged 4 commits intomasterfrom
feat/meikel/warn-about-event-drop

Conversation

@meikelmosby
Copy link
Contributor

@meikelmosby meikelmosby commented Mar 21, 2025

Problem

Soon we release custom hog transformations and people need to be aware that if they return null or undefined that this will lead to event dropping.

Changes

  • introduced detection of null or undefined returning
  • assigning null or undefined and then returning it also shows the warning
  • added debounce to not run it on every keystroke
  • added scrolling to code editor when clicking editing the source code

2025-03-21 10 40 20

2025-03-21 10 44 19

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

How did you test this code?

@meikelmosby meikelmosby mentioned this pull request Mar 21, 2025
26 tasks
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Added functionality to warn users when Hog transformation functions might inadvertently drop events by returning null or undefined values, helping prevent data loss in the CDP pipeline.

  • Added mightDropEvents helper function in /frontend/src/scenes/pipeline/hogfunctions/HogFunctionConfiguration.tsx to detect potential null/undefined returns
  • Implemented warning display via LemonBanner when editing transformation functions that could drop events
  • Enhanced detection to catch both direct null/undefined returns and indirect returns through variable assignments

1 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

@github-actions
Copy link
Contributor

github-actions bot commented Mar 21, 2025

Size Change: +3 B (0%)

Total Size: 9.75 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 9.75 MB +3 B (0%)

compressed-size-action

…out-event-drop

# Conflicts:
#	frontend/src/scenes/pipeline/hogfunctions/HogFunctionConfiguration.tsx
#	frontend/src/scenes/pipeline/hogfunctions/hogFunctionConfigurationLogic.tsx
@meikelmosby meikelmosby dismissed benjackwhite’s stale review March 24, 2025 08:49

you were on vacation.

@meikelmosby meikelmosby merged commit 6281fea into master Mar 24, 2025
109 checks passed
@meikelmosby meikelmosby deleted the feat/meikel/warn-about-event-drop branch March 24, 2025 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants