Repository navigation
fix(app): open the alert panel from a dashboard tile's alert button - #3680
kodiakhq[bot] merged 7 commits into
Conversation
The tile's bell opened the plain tile editor, so the alert panel needed a second click. It now opens the editor on the tile's alert, or on a new draft where the editor offers alerts.
|
@gedaliakliger is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: 8e02d3c 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 |
| getFormReferenceVariables(savedFormValue).length === 0 && | ||
| !IS_LOCAL_MODE && | ||
| savedChartConfigSupportsAlerts(chartConfig); | ||
| const formValue: ChartEditorFormState = useMemo(() => { |
There was a problem hiding this comment.
🟡 P2 — Putting the draft alert into the form's defaultValues makes discarding it look like an unsaved edit
formValue (with the draft alert) is passed as defaultValues/values, so RHF treats the draft as the saved state. When the user closes the panel, cancelAlertChanges(true) sets alert to undefined. From then on _getDirty() sees a difference from the defaults, so the next field edit, even one that is reverted, makes isDirty true. Closing the editor (EditTileModal.handleClose) then asks to discard changes on a tile the user never changed. Fix: keep savedFormValue as the form's defaults and add the draft after mount with setValue('alert', …) (the path the Add alert button already uses), so the defaults still match the saved tile.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
There was a problem hiding this comment.
I tested this and the draft in the defaults doesn't change when the discard prompt shows. With the bell unused and no alert on the tile, typing a character into Chart Name and deleting it already ends on onDirtyChange(true), so an edited-then-reverted field prompts on main too. I also tried the suggested setValue('alert', …) after mount: same result. Closing the draft panel with no other edit leaves isDirty false, since cancelAlertChanges sets the value without shouldDirty. Leaving it as is.
PR Review
3 finding(s): 🔴 0 P0/P1 · 🟡 1 P2 · 🔵 2 P3 1 posted as inline comment(s) on the changed lines. 2 P3 folded at the bottom. 🔵 2 P3 — no action needed before merge
Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides. |
Deep Review✅ No critical issues found. No P0/P1: the change is a client-side UX routing fix over existing alert-save paths — no data-loss, crash, auth, or injection path. The one prior high-severity concern (bell-opened existing-alert edits failing to revert) was verified as a non-issue: react-hook-form deep-clones 🟡 P2 — recommended
🔵 P3 nitpicks (5)
Reviewers (10): correctness, adversarial, testing, maintainability, project-standards, kieran-typescript, frontend-races, previous-comments, agent-native, learnings-researcher. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
|
On the Deep Review P2 ( |
…rt-opens-panel # Conflicts: # packages/app/src/components/DBEditTimeChartForm/EditTimeChartForm.tsx
| getFormReferenceVariables(savedFormValue).length === 0 && | ||
| !IS_LOCAL_MODE && | ||
| savedChartConfigSupportsAlerts(chartConfig); | ||
| const formValue: ChartEditorFormState = useMemo(() => { |
There was a problem hiding this comment.
🟡 P2 — The draft alert is put into the form's defaultValues, so discarding it makes an untouched tile count as edited
formValue, including the seeded alert, is passed as defaultValues/values to useForm. When the user closes the panel, cancelAlertChanges(true) sets alert to undefined, so the form no longer matches its defaults. The next dirty recompute (any field change, even one typed and then reverted) reports isDirty, and EditTileModal (DBDashboardPage.tsx:1737) then asks 'You have unsaved changes…' for a tile the user never changed. The Add alert button path doesn't have this problem because its defaults contain no alert. Fix: keep defaultValues equal to savedFormValue and seed the draft once on mount with setValue('alert', …), the same way onAddAlert does it. Add a test that closes the draft and checks that onDirtyChange is not reported as true.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
There was a problem hiding this comment.
Same finding as the thread above, and my answer there still holds: an edited-then-reverted field ends on onDirtyChange(true) on main too, with no alert involved, and seeding with setValue('alert', …) after mount gave the same result when I tried it. Closing the draft with no other edit leaves isDirty false. Leaving it as is.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 6ea34c9. Configure here.
… tile alert button
|
This is the second round of bot findings, so I'm stopping here per AGENTS.md. Round two had no P0/P1: the Bugbot finding doesn't reproduce (test added in bf47224) and the P2 repeats the one answered above. Could a maintainer take a look at the scope when there's time? CI is still waiting on approval. |
| runChart, | ||
| // The resolver only checks the alert. The chart runs without it, and | ||
| // the alert's errors are neither shown nor focused. | ||
| ignoresNewAlert |
There was a problem hiding this comment.
🟡 P2 — The first-run bypass ignores every resolver error, not just alert errors
The onInvalid callback drops the errors argument and runs the chart whenever ignoresNewAlert is true. It rests on the comment's claim that the resolver checks only the alert, but chartFormResolver runs the whole zSavedChartConfig. If any non-alert field fails, the chart still runs and that error stays set in the form without being reported. Fix: only take the bypass when Object.keys(errors) is exactly ['alert']; otherwise fall through to the normal invalid handling.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond
pulpdrew
left a comment
There was a problem hiding this comment.
LGTM, thanks for the contribution
| getFormReferenceVariables(savedFormValue).length === 0 && | ||
| !IS_LOCAL_MODE && | ||
| savedChartConfigSupportsAlerts(chartConfig); | ||
| const formValue: ChartEditorFormState = useMemo(() => { |
There was a problem hiding this comment.
🟡 P2 — Discarding the bell-opened draft leaves the form dirty against its defaults, so the editor asks about unsaved changes when nothing changed
The draft alert goes into defaultValues/values, but closing the panel calls setValue('alert', undefined) (cancelAlertChanges, line ~1001). RHF then compares every later field change against defaults that still hold the draft, so isDirty stays true. Repro: click the bell, close the alert panel, type a character in the chart name and delete it, close the modal. EditTileModal (DBDashboardPage.tsx:1742) shows the 'Discard' confirm. Fix: keep defaultValues as savedFormValue and add the draft with setValue('alert', …) on mount, the way the Add alert button does (ChartEditorControls.tsx:520). The alternative is to drop the draft from the defaults when it is discarded.
Advisory. Fix if it is a small defect in code this PR changes; otherwise reply in the thread. Do not widen the PR or touch files it did not already change. How to respond

Summary
The bell on a dashboard tile (and the alert item in a narrow tile's menu) called
onEditClick, so it opened the same editor as Edit. Since #3222 the alert form lives in a side panel that opens only on request, so after clicking the bell you had to click Add alert or Edit alert again inside the editor.Tilehas declared anonAddAlertClickprop since the v2 dashboard, but nothing wired it.onAlertClick, which opens the tile editor with the newdefaultAlertPanelOpened.EditTimeChartFormthen opens the alert panel from the start, on the tile's alert. A tile without one gets a new alert, filled in as the Add alert button fills it (DEFAULT_TILE_ALERTplus the tile name as display name), and the panel opens it as a draft, so closing the panel discards it, as with the button.savedChartConfigSupportsAlerts. On a temporary dashboard the bell still opens a plain editor.eugeneo17's #3194 fixed this before the alert panel landed and was closed by the open-PR limit; its review is where the temporary-dashboard case came up.
Checks run here: the five related suites (
DBEditTimeChartForm,AlertPanel,AlertPanelButton,TileAlertEditor,EditInlineAlertModal, 95 tests), ESLint and Prettier on the changed files (no new warnings),node scripts/ci/ratchet.mjs, andtsc --noEmitonpackages/app. Left to CI: lint and unit tests across packages, and E2E. No unit test covers theDBDashboardPagewiring, since the page has no component test harness; the E2E dashboard specs already reach the button throughgetTileButton('alerts').Screenshots or video
I couldn't capture these: local mode hides the tile alert editor (
yarn app:dev:localand the Vercel preview), and the full stack needs Docker, which I don't have here.How to reproduce
Starting point:
yarn dev(alerts need the API), a saved dashboard with a Line or Number tile on the Logs source.On
main:On this branch:
How to test on Vercel preview
N/A: the tile alert editor is hidden in local mode, so the preview can't show it.
References
Note
Low Risk
UX wiring in the dashboard tile editor and alert form; no API, auth, or persistence logic changes beyond existing alert save flows.
Overview
Dashboard tile bell actions no longer open the generic tile editor via
onEditClick; they use a dedicatedonAlertClickpath that opensEditTileModalwithdefaultAlertPanelOpened, so the alert side panel is visible immediately (existing alert or a new draft).EditTimeChartFormhonors that flag: tiles without an alert get a prefilledDEFAULT_TILE_ALERTdraft (tile name as display name) andAlertPanelLayoutopens as a draft thatdefaultIsDraftcan discard on close. The first chart run skips alert validation when the draft has no webhook yet, so auto-run still loads a preview; normal edit still clears the alert-open flag.Temporary dashboards, local mode, and charts that cannot support alerts still open the editor without forcing the alert panel. Unit and E2E tests cover the new open/discard/run behavior.
Reviewed by Cursor Bugbot for commit 8e02d3c. Bugbot is set up for automated code reviews on this repo. Configure here.