Skip to content

fix: prevent false "data source not set" error on markdown dashboard tiles#2202

Merged
kodiakhq[bot] merged 3 commits intohyperdxio:mainfrom
vinzee:va/fix-mcp-dashboard-text-tiles
May 6, 2026
Merged

fix: prevent false "data source not set" error on markdown dashboard tiles#2202
kodiakhq[bot] merged 3 commits intohyperdxio:mainfrom
vinzee:va/fix-mcp-dashboard-text-tiles

Conversation

@vinzee
Copy link
Copy Markdown
Contributor

@vinzee vinzee commented May 5, 2026

Problem

Markdown tiles created via the external API or MCP always show the following error:

The data source for this tile is not set. Edit the tile to select a data source.

...even though markdown tiles do not require a data source. Tiles created through the UI do not exhibit this problem.

Root Cause

convertToInternalTileConfig stores source: '' on the internal config for markdown tiles to satisfy the BuilderSavedChartConfig TypeScript type, which requires a source field:

case 'markdown':
  internalConfig = {
    displayType: DisplayType.Markdown,
    markdown: externalConfig.markdown,
    source: '',   // <-- required by type, but semantically empty
    ...
  } satisfies BuilderSavedChartConfig;

The frontend's isSourceUnset check in DBDashboardPage used
!chart.config.source, which evaluates to true for an empty string,
incorrectly triggering the error banner for every API-created markdown tile:

const isSourceUnset =
  !!chart.config &&
  isBuilderSavedChartConfig(chart.config) &&
  !chart.config.source;  // true for '', fires on all markdown tiles

Solution

Add a displayType !== DisplayType.Markdown guard to isSourceUnset so
markdown tiles are never considered to have an unset source:

const isSourceUnset =
  !!chart.config &&
  isBuilderSavedChartConfig(chart.config) &&
  chart.config.displayType !== DisplayType.Markdown &&
  !chart.config.source;

Tests

  • packages/common-utils: unit tests for isBuilderSavedChartConfig and
    the isSourceUnset pattern, verifying that markdown tiles evaluate to
    false (no error shown) even when source is ''
  • packages/api: unit tests for convertToInternalTileConfig covering
    the markdown tile conversion path and tile layout field preservation

@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

@vinzee is attempting to deploy a commit to the HyperDX Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 5, 2026

🦋 Changeset detected

Latest commit: 0adae28

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@hyperdx/app Patch
@hyperdx/common-utils Patch
@hyperdx/api Patch
@hyperdx/otel-collector Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

PR Review

✅ No critical issues found.

Targeted, well-scoped fix for the false "data source not set" banner on markdown tiles. Notes:

  • Good encapsulation — extracting displayTypeRequiresSource() in common-utils/src/guards.ts:42 is cleaner than the inline displayType !== DisplayType.Markdown shown in the PR description, and the doc comment correctly flags it as the canonical location for future sourceless display types.
  • Test coverage — both the guard unit tests and the API conversion tests directly exercise the bug path (markdown tile with source: '').
  • Changeset present with correct package scope (@hyperdx/app, @hyperdx/common-utils).
  • 💡 Optional follow-up (non-blocking): packages/app/src/components/ChartEditor/utils.ts:216,227,244 still has three inline form.displayType !== DisplayType.Markdown checks that could adopt the new helper for consistency. Fine to defer to a separate PR given this one is intentionally scoped.

@vinzee vinzee force-pushed the va/fix-mcp-dashboard-text-tiles branch from a091a1b to 923869d Compare May 5, 2026 21:01
…d tiles

Markdown tiles created via the external API or MCP always showed
\"The data source for this tile is not set. Edit the tile to select
a data source.\" in the dashboard UI, despite not requiring a source.

Root cause: convertToInternalTileConfig stores source: '' on the
internal config to satisfy BuilderSavedChartConfig's required source
field. The frontend's isSourceUnset check used !chart.config.source,
which evaluates to true for an empty string, incorrectly triggering
the error banner for every API-created markdown tile.

Fix: add chart.config.displayType !== DisplayType.Markdown to the
isSourceUnset guard in DBDashboardPage so markdown tiles are never
considered to have an unset source.

Tests added:
- packages/common-utils: unit tests for isBuilderSavedChartConfig and
  the isSourceUnset pattern, verifying markdown tiles are excluded
- packages/api: unit tests for convertToInternalTileConfig covering
  the markdown tile conversion and layout field preservation

Co-authored-by: Cursor <cursoragent@cursor.com>
@vinzee vinzee force-pushed the va/fix-mcp-dashboard-text-tiles branch from 923869d to bcfb9b4 Compare May 5, 2026 21:07
@brandon-pereira brandon-pereira self-requested a review May 6, 2026 14:53
Copy link
Copy Markdown
Member

@brandon-pereira brandon-pereira left a comment

Choose a reason for hiding this comment

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

LGTM - thanks!

@vercel
Copy link
Copy Markdown

vercel Bot commented May 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hyperdx-oss Ready Ready Preview, Comment May 6, 2026 11:11pm

Request Review

@kodiakhq kodiakhq Bot merged commit a5294f8 into hyperdxio:main May 6, 2026
18 checks passed
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.

2 participants