Repository navigation
fix(app): open the alert panel from a dashboard tile's alert button - #3680
gedaliakliger wants to merge 2 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: 5fffdb9 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
PR Review
4 finding(s): 🔴 0 P0/P1 · 🟡 1 P2 · 🔵 3 P3 1 posted as inline comment(s) on the changed lines. 3 P3 folded at the bottom. 🔵 3 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. This change is well-scoped frontend view-state plumbing: it wires the dashboard tile's alert bell to
🟡 P2 -- recommended
🔵 P3 nitpicks (2)
Reviewers (9 dispatched): correctness, adversarial, testing, maintainability, project-standards, kieran-typescript, julik-frontend-races, ce-agent-native-reviewer, ce-learnings-researcher. At synthesis time, agent-native (no parity gap — the bell is UI-only view state over the unchanged alert save path) and learnings (no relevant prior solutions in 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 |
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