Skip to content

fix(dashboard): prevent unhandled promise rejections and CodeMirror crash#10576

Draft
cursor[bot] wants to merge 1 commit intonextfrom
cursor/sentry-error-investigation-3f91
Draft

fix(dashboard): prevent unhandled promise rejections and CodeMirror crash#10576
cursor[bot] wants to merge 1 commit intonextfrom
cursor/sentry-error-investigation-3f91

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor bot commented Apr 4, 2026

What changed

Fixes two categories of production Sentry errors in the dashboard:

1. Unhandled promise rejections at mutateAsync call sites

Error signatures: DASHBOARD-282, plus similar patterns in topic/context creation and subscriber deletion.

Root cause: TanStack Query's mutateAsync re-throws errors after the onError callback runs. When the calling code uses await mutateAsync() without a try-catch, the re-thrown error becomes an unhandled promise rejection that Sentry captures.

Fix: Added try-catch blocks at all affected call sites:

  • create-subscriber.tsx — subscriber creation (DASHBOARD-282: 23 events, 11 users)
  • create-topic-form.tsx — topic creation
  • create-context-form.tsx — context creation
  • subscriber-row.tsx — subscriber deletion
  • subscriber-overview-form.tsx — subscriber deletion from overview

This follows the same pattern already used in upsert-variable-form.tsx and other existing call sites.

2. CodeMirror crash on non-string value

Error signature: DASHBOARD-2M8 — value must be typeof string but got object

Root cause: The Editor component passes its value prop directly to @uiw/react-codemirror, which throws at runtime if the value is not a string. When react-hook-form provides an object value (e.g., from a step control schema with nested types), this crashes the editor.

Fix: Added safe string coercion (typeof value === 'string' ? value : String(value ?? '')) in the Editor component before passing to CodeMirror. This is the single choke point for all CodeMirror usage in the dashboard.

Remaining risk

  • Minimal — all changes are defensive error handling at leaf call sites
  • No behavioral changes when mutations succeed
  • The upsert-variable-form.tsx already uses this exact try-catch pattern successfully
Open in Web View Automation 

… sites

Addresses DASHBOARD-282 and similar unhandled rejection errors across
the dashboard. When TanStack Query's mutateAsync is awaited and the
mutation fails, the onError callback runs but the promise still rejects.
Without a try-catch at the call site, this produces an unhandled
rejection that Sentry captures.

Fixed call sites:
- create-subscriber.tsx (DASHBOARD-282: 23 events, 11 users)
- create-topic-form.tsx
- create-context-form.tsx
- subscriber-row.tsx (delete subscriber)
- subscriber-overview-form.tsx (delete subscriber)

Also coerces Editor component value to string to prevent CodeMirror
crash when react-hook-form passes a non-string value (DASHBOARD-2M8).

Co-authored-by: Dima Grossman <dima@grossman.io>
@netlify
Copy link
Copy Markdown

netlify bot commented Apr 4, 2026

Deploy Preview for dashboard-v2-novu-staging ready!

Name Link
🔨 Latest commit b335fab
🔍 Latest deploy log https://app.netlify.com/projects/dashboard-v2-novu-staging/deploys/69d101b544317d0008296f57
😎 Deploy Preview https://deploy-preview-10576.dashboard-v2.novu-staging.co
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 4, 2026

Hey there and thank you for opening this pull request! 👋

We require pull request titles to follow specific formatting rules and it looks like your proposed title needs to be adjusted.

Your PR title is: fix(dashboard): prevent unhandled promise rejections and CodeMirror crash

Requirements:

  1. Follow the Conventional Commits specification
  2. As a team member, include Linear ticket ID at the end: fixes TICKET-ID or include it in your branch name

Expected format: feat(scope): Add fancy new feature fixes NOV-123

Details:

PR title must end with 'fixes TICKET-ID' (e.g., 'fixes NOV-123') or include ticket ID in branch name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant