Repository navigation
fix(app): open the alert panel from a dashboard tile's alert button - #3680
gedaliakliger wants to merge 4 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: bf47224 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
4 finding(s): 🔴 0 P0/P1 · 🟡 2 P2 · 🔵 2 P3 1 posted as inline comment(s) on the changed lines. 2 P3 folded at the bottom. 1 unchanged from an earlier push (already inline above). 🔵 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. The change is sound: the seeded draft alert enters the form as 🟡 P2 -- recommended
🔵 P3 nitpicks (3)
Reviewers (7): correctness, testing, maintainability, project-standards, kieran-typescript, adversarial, previous-comments. 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

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
UI-only workflow fix in the dashboard tile editor and alert panel, with broad unit test coverage and no auth or data-layer changes.
Overview
Dashboard tile bell actions (toolbar and narrow-tile menu) no longer open the generic tile editor via
onEditClick. They callonAlertClick, which setsisEditingTileAlertand opensEditTileModalwithdefaultAlertPanelOpened.EditTimeChartFormhonors that flag: tiles with an alert open the side panel on that alert; eligible tiles without one get aDEFAULT_TILE_ALERTdraft (tile name as display name) withAlertPanelLayoutopened as a draft so closing discards it. The panel stays closed on surfaces that don't offer alerts (e.g. temporary dashboard / nodashboardId). Until the chart has run once, the first run strips the draft alert so missing-webhook validation doesn't block the preview.AlertPanelLayoutgainsdefaultIsDraftso an initially open draft behaves like Add alert when closed without confirming.Reviewed by Cursor Bugbot for commit bf47224. Bugbot is set up for automated code reviews on this repo. Configure here.