Skip to content

feat(chart): support ?run=true to auto-execute chart on load#1961

Open
sanjams2 wants to merge 1 commit intohyperdxio:mainfrom
sanjams2:feat/chart-explorer-auto-run
Open

feat(chart): support ?run=true to auto-execute chart on load#1961
sanjams2 wants to merge 1 commit intohyperdxio:mainfrom
sanjams2:feat/chart-explorer-auto-run

Conversation

@sanjams2
Copy link
Contributor

Summary

Adds support for a ?run=true query parameter on the Chart Explorer page. When present, the chart query is executed automatically once on page load instead of waiting for the user to click the run button.

The motivation is external tools that translate queries from other systems into HyperDX chart configs and deeplink the user into the /chart page. Today the user lands on a fully-populated form but still has to click once to see results; with ?run=true the chart renders immediately.

The form gains an autoRun prop. When true, a latched effect calls onSubmit() exactly once after the source data has loaded, so form validation has the table metadata it needs. The Chart Explorer page reads ?run via nuqs parseAsBoolean and passes it through.

How to test locally or on Vercel

  1. yarn dev in packages/app
  2. Open /chart?run=true&config=%7B%22name%22%3A%22%22%2C%22select%22%3A%5B%7B%22aggFn%22%3A%22count%22%2C%22aggCondition%22%3A%22%22%2C%22aggConditionLanguage%22%3A%22sql%22%2C%22valueExpression%22%3A%22%22%7D%5D%2C%22where%22%3A%22%22%2C%22whereLanguage%22%3A%22sql%22%2C%22displayType%22%3A%22line%22%2C%22granularity%22%3A%22auto%22%2C%22source%22%3A%22<your-source-id>%22%7D — replace <your-source-id> with a real source id from your instance
  3. The chart should render results without clicking the run button
  4. Open the same URL without &run=true — the form should be populated but not executed until you click run

## Summary

Adds support for a `?run=true` query parameter on the Chart Explorer page. When present, the chart query is executed automatically once on page load instead of waiting for the user to click the run button.

The motivation is external tools that translate queries from other systems into HyperDX chart configs and deeplink the user into the `/chart` page. Today the user lands on a fully-populated form but still has to click once to see results; with `?run=true` the chart renders immediately.

The form gains an `autoRun` prop. When true, a latched effect calls `onSubmit()` exactly once after the source data has loaded, so form validation has the table metadata it needs. The Chart Explorer page reads `?run` via nuqs `parseAsBoolean` and passes it through.

### How to test locally or on Vercel

1. `yarn dev` in `packages/app`
2. Open `/chart?run=true&config=%7B%22name%22%3A%22%22%2C%22select%22%3A%5B%7B%22aggFn%22%3A%22count%22%2C%22aggCondition%22%3A%22%22%2C%22aggConditionLanguage%22%3A%22sql%22%2C%22valueExpression%22%3A%22%22%7D%5D%2C%22where%22%3A%22%22%2C%22whereLanguage%22%3A%22sql%22%2C%22displayType%22%3A%22line%22%2C%22granularity%22%3A%22auto%22%2C%22source%22%3A%22<your-source-id>%22%7D` — replace `<your-source-id>` with a real source id from your instance
3. The chart should render results without clicking the run button
4. Open the same URL without `&run=true` — the form should be populated but not executed until you click run
@changeset-bot
Copy link

changeset-bot bot commented Mar 21, 2026

🦋 Changeset detected

Latest commit: 6e3da8d

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

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app 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

@vercel
Copy link

vercel bot commented Mar 21, 2026

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

A member of the Team first needs to authorize it.

@github-actions
Copy link
Contributor

PR Review

  • ⚠️ onSubmit() called without suppressErrorNotification=true will display error toast notifications to the user on page load if validation fails → consider calling onSubmit(true) in the autoRun effect to suppress noisy error toasts on initial load (users haven't interacted yet)

Everything else looks solid: the useRef latch correctly prevents duplicate fires, waiting on tableSource before submitting is the right guard, and the nuqs parseAsBoolean.withDefault(false) integration is idiomatic.

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.

1 participant