feat(event-meta): add description field to EventMeta#390
feat(event-meta): add description field to EventMeta#390Shrotriya-lalit wants to merge 3 commits into
Conversation
Adds an optional description/note field to event definitions so teams can document what each event means directly in the OpenPanel UI — a lightweight alternative to a separate wiki. Changes: - Prisma schema: `description String?` on EventMeta model - Migration: ALTER TABLE event_meta ADD COLUMN description TEXT - tRPC router: accept and persist description in updateEventMeta - Edit-event modal: textarea to set/edit the description Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The close button was a plain Button calling popModal(), which could race with Radix's internal open-state tracking. Wrapping it in DialogClose (asChild) lets Radix own the close event — same mechanism as clicking outside the dialog. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds an optional event description through Prisma + migration, extends the tRPC updateEventMeta mutation to accept and persist description, updates the EditEvent modal to edit and send description, and refactors the modal close button to use Radix DialogClose calling only onClose?.(). ChangesEvent description editing feature
Modal close button refactor
Sequence DiagramsequenceDiagram
participant Frontend as EditEvent Modal
participant API as tRPC updateEventMeta
participant DB as Postgres (event_meta)
Frontend->>API: mutate updateEventMeta({ meta: {...}, description: description.trim() })
API->>DB: db.eventMeta.upsert(create/update with description)
DB-->>API: upsert result
API-->>Frontend: mutation response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/start/src/modals/edit-event.tsx`:
- Line 220: The payload currently drops empty descriptions by using
description.trim() || undefined; update the payload in edit-event.tsx so the
description field sends an explicit empty string when the trimmed input is empty
(or simply send description.trim() without coalescing to undefined) to allow
clearing an existing description; change the object property that uses
description (the description: ... entry) to pass the trimmed value even when
it's empty so updates can clear stored descriptions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 5da985c3-4d89-4706-ba99-c5cb93b8a650
📒 Files selected for processing (5)
apps/start/src/modals/Modal/Container.tsxapps/start/src/modals/edit-event.tsxpackages/db/prisma/migrations/20260607120000_add_event_meta_description/migration.sqlpackages/db/prisma/schema.prismapackages/trpc/src/routers/event.ts
Sending `trim() || undefined` silently dropped empty input, preventing users from clearing an existing description. Now sends the trimmed value directly so an empty string is passed and the server can clear the field. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There is no way to document what an event means inside OpenPanel. Teams end up maintaining a separate wiki or spreadsheet to explain their event taxonomy — this adds that context directly to the platform.
Changes
schema.prisma: add optionaldescription String?field toEventMetamodelmigration.sql:ALTER TABLE event_meta ADD COLUMN IF NOT EXISTS "description" TEXTpackages/trpc/src/routers/event.ts: accept and persistdescriptioninupdateEventMetaapps/start/src/modals/edit-event.tsx: textarea in the Edit Event modal to set/edit the descriptionapps/start/src/modals/Modal/Container.tsx: fix modal X button — wrap inDialogClose(Radix native) instead of callingpopModal()directly, which could race with Radix's internal open-state trackingHow it looks
Open any event in the Events page → click the icon → Edit Event modal now has a Description field below the Conversion checkbox.
Future scope
The description field is a foundation for a full Lexicon view (event catalog with descriptions, display names, volume — similar to Mixpanel Lexicon). That can be built as a follow-up.
Summary by CodeRabbit
New Features
Improvements