feat(app): edit multiple notification channels on alerts - #2848
feat(app): edit multiple notification channels on alerts#2848jordan-simonovski wants to merge 4 commits into
Conversation
🦋 Changeset detectedLatest commit: c5d1dd7 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 |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThe alert forms now preserve and edit the complete notification-channel list for saved searches and dashboard tiles.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| packages/app/src/components/Alerts.tsx | Reworks the shared alert-channel editor around a watched field array with duplicate prevention, channel limits, and webhook service icons. |
| packages/app/src/DBSearchPageAlertModal.tsx | Migrates saved-search alert validation, defaults, editing, and submission from the singular channel field to channels. |
| packages/app/src/components/ChartEditor/utils.ts | Normalizes legacy tile-alert channel data when converting persisted chart configurations into form state. |
| packages/app/src/components/DBEditTimeChartForm/TileAlertEditor.tsx | Updates the tile alert editor to bind its controls to the plural channel array. |
| packages/app/src/utils/alerts.ts | Adds shared legacy-channel normalization and changes new tile alerts to use the plural channel representation. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
Legacy[Legacy singular channel] --> Normalize[toAlertChannels]
Existing[Existing channels list] --> Normalize
Normalize --> Form[AlertChannelForm field array]
Form --> Edit[Add, remove, or select webhooks]
Edit --> Submit[Submit plural channels]
Submit --> Clear[Omit legacy channel field]
Reviews (3): Last reviewed commit: "test(app): cover the legacy channel-clea..." | Re-trigger Greptile
Deep Review✅ No critical issues found. The channel/channels round-trip is sound: the saved-search form clears the legacy 🟡 P2 — recommended
🔵 P3 nitpicks (2)
Reviewers (6): correctness, testing, maintainability, kieran-typescript, julik-frontend-races, api-contract. Testing gaps:
|
d09ad2b to
06858e2
Compare
🟡 Tier 3 — StandardIntroduces new logic, modifies core functionality, or touches areas with non-trivial risk. Why this tier:
Review process: Full human review — logic, architecture, edge cases. Stats
|
E2E Test Results✅ All tests passed • 275 passed • 1 skipped • 915s
Tests ran across 4 shards in parallel. |
Saved search and dashboard tile alert forms now edit the plural channels list instead of a single channel, so a multi-channel alert survives a save from the UI. Channels can be added and removed inline up to the API's limit of 10, and a webhook already used by the alert is disabled in the other pickers because duplicates are rejected server-side. Alerts saved before multi-channel support are normalised on load, and the legacy channel field is cleared on submit so a stale value can never conflict with an edited list.
Each option and the selected value carry the Slack / generic / incident.io icon, so the destination is visible without opening the webhook settings. AlertChannelForm now takes the channels field path directly instead of a string prefix, which drops two generic-boundary type assertions.
AlertChannelForm had no coverage: adding and removing rows, the last row staying non-removable so an alert always has a target, a webhook already chosen being disabled in the other pickers (duplicates are rejected server-side), and the cap disabling the add button.
Both alert forms clear the legacy singular `channel` so a stale value can't be submitted alongside an edited channels list — the API rejects that combination. Neither path was tested. Covers the tile form's load-time normalisation and the saved-search form's submitted payload.
06858e2 to
c5d1dd7
Compare
Lets the alert forms edit the full list of notification channels. Until now the API supported several channels but both forms still edited a single one, so saving from the UI would silently drop the rest.
CleanShot.2026-08-09.at.21.01.38.mp4
What changed
Saved search and dashboard tile alerts both edit the plural
channelslist through the sharedAlertChannelForm. Channels can be added and removed inline up to the API's limit of 10, and each row shows the webhook's service icon so the destination is visible without opening webhook settings.A webhook already used by the alert is disabled in the other pickers, since duplicates are rejected server-side.
Alerts saved before multi-channel support are normalised on load, and the legacy
channelfield is cleared on submit so a stale value can never conflict with an edited list.Key decisions
The last channel row is not removable. An alert with no target would fire into the void, and the API rejects it anyway, so the remove control only appears once there are two or more rows.
A webhook created from the picker fills the first empty row. Otherwise the user would create a webhook and then have to find and select it manually.
AlertChannelFormtakes the field path rather than a string prefix. Callers passchannelsoralert.channelsdirectly, which types correctly and removes two generic-boundary casts.Impact
Closes the UI overwrite hazard documented as a known limitation until now: editing a multi-channel alert in the app now preserves its channels.
Implementation detail
The picker is a
useFieldArraywith auseWatchon the array —fieldsholds last-render values, so the live ones are needed for the duplicate check.Component tests cover adding and removing rows, the last row staying non-removable, duplicate disabling across rows, and the cap disabling the add button.
toAlertChannelshas unit coverage for both document vintages.Verification: 2745 app unit tests.