feat(chart): support ?run=true to auto-execute chart on load#1961
Open
sanjams2 wants to merge 1 commit intohyperdxio:mainfrom
Open
feat(chart): support ?run=true to auto-execute chart on load#1961sanjams2 wants to merge 1 commit intohyperdxio:mainfrom
sanjams2 wants to merge 1 commit intohyperdxio:mainfrom
Conversation
## 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 detectedLatest commit: 6e3da8d The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
|
@sanjams2 is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
PR Review
Everything else looks solid: the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for a
?run=truequery 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
/chartpage. Today the user lands on a fully-populated form but still has to click once to see results; with?run=truethe chart renders immediately.The form gains an
autoRunprop. When true, a latched effect callsonSubmit()exactly once after the source data has loaded, so form validation has the table metadata it needs. The Chart Explorer page reads?runvia nuqsparseAsBooleanand passes it through.How to test locally or on Vercel
yarn devinpackages/app/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&run=true— the form should be populated but not executed until you click run