feat(panes): a pane that throws shows its own error, not the whole workspace's

Merged
SA
2mo ago
+347-13

Why

A render error in one pane reached the dashboard's ContentBoundary, which replaced the whole workspace with "This view hit an error". The pane was saved in the layout, so both "Reload app" and reopening the workspace brought the same screen back. That is how a user got locked out of a workspace (the underlying duplicate-row bug was fixed in #7980).

What changes

  • PaneErrorBoundary wraps each pane body in packages/panes. The pane keeps its header. The body shows "This pane hit an error", the message, Retry and Close pane. Close pane removes the pane from the saved layout. The boundary resets when the pane's data changes.
  • PaneContent calls renderPane itself, so a throw inside renderPane is caught too.
  • Workspace takes onPaneError; the desktop passes reportRendererError, so these errors still reach Sentry.
  • A pane of an unknown kind uses the same PaneFallback ("This pane can't be shown" / "Unknown pane type: x") with a Close pane button, in place of a bare text line. Its header reads "Unknown pane".
  • Three new strings, translated in every locale.

Screenshots: https://app.superset.sh/page/pane-fallback-states-4evyq7

Verification

  • Dev app over CDP, on the original duplicate-rename bug (host-service without #7980): the error stayed in the Changes pane, the terminal and sidebar kept working, a reload kept the workspace usable, Close pane removed the pane and it stayed removed after a reload, and reportRendererError fired once.
  • Dev app, split tab with a DevTools pane holding data: null (throws in renderPane) and a pane of kind inbox-preview: both fallbacks render in their panes, including at 28% width; both Close pane buttons work.
  • panes tests 114/114, panes and desktop typecheck, lint, check:i18n.

Not covered: a throw in a pane's header (renderTitle, renderHeaderExtras, renderToolbar) still reaches ContentBoundary.


Summary by cubic

A render error in one pane no longer replaces the whole workspace with "This view hit an error", which previously locked users out of that workspace because the broken pane stayed in the saved layout. Each pane body is now wrapped in its own error boundary: the pane keeps its header, shows the error with Retry and Close pane, and Close pane removes it from the saved layout.

Bug Fixes

  • Errors still reach Sentry through the new onPaneError handler; the desktop passes reportRendererError.
  • Unknown pane kinds now use the same fallback with a Close pane button instead of a bare text line.
  • The boundary resets when the pane's data changes.
  • A throw in a pane's header (renderTitle, renderHeaderExtras, renderToolbar) is not covered and still hits the workspace content boundary.

Summary by CodeRabbit

  • New Features
    • Panes that encounter rendering errors now show a helpful message with options to retry or close them.
    • Unknown pane types display a localized message and can be closed.
    • Pane error messages are available in 17 languages.