Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The retained notification ID outlives the form state, allowing reports to show “sent” with blank details and potentially pass the other channel’s report guard.
1 open issue
What changed in this PR
This PR aims to make post-send confirmation more reliable by separating the sent notification ID from editable form state and redirecting to History when that ID is missing.
Changes:
- Introduces shared previous-send state and updates confirmation pages to consume it.
- Handles unexpected send errors through the existing failure flow.
- Expands send-hook tests and updates Storybook fixtures for the new context.
| File | Description |
|---|---|
src/apps/frontend/src/utils/notification-forms.ts |
Removes notification IDs from form schemas. |
src/apps/frontend/src/testing/useNotificationFormStory.tsx |
Supplies previous-send context to stories. |
src/apps/frontend/src/send/SendFailedModal.tsx |
Explicitly discards the retry promise. |
src/apps/frontend/src/send/SendConfirmationModal.tsx |
Explicitly discards the send promise. |
src/apps/frontend/src/send/DispatchReport.tsx |
Reads IDs from context and falls back to History. |
src/apps/frontend/src/send/DispatchReport.stories.tsx |
Updates report fixtures and interaction coverage. |
src/apps/frontend/src/previous-send/PreviousSendContext.tsx |
Adds the previous-send context and provider. |
src/apps/frontend/src/hooks/useSendNotification.ts |
Stores successful IDs in context and catches unexpected errors. |
src/apps/frontend/src/hooks/useSendNotification.test.tsx |
Preserves history tests and adds failure, retry, and navigation coverage. |
src/apps/frontend/src/hooks/useSendNotification.test.ts |
Removes the test file replaced by the TSX suite. |
src/apps/frontend/src/compose/CreateNewsletterEmailForm.tsx |
Removes the form-derived notification ID from preparation telemetry. |
src/apps/frontend/src/compose/CreateAppAlertForm.tsx |
Removes the form-derived notification ID from preparation telemetry. |
src/apps/frontend/src/App.tsx |
Wraps application routes in the previous-send provider. |
Review effort: Balanced
| } | ||
| > | ||
| <Route path="create" element={<CreateNewsletterEmailTab />} /> | ||
| <PreviousSendProvider> |
| } catch (cause) { | ||
| console.error('Unexpected notification send failure', { | ||
| cause, | ||
| idempotencyKey, |
Contributor
There was a problem hiding this comment.
Should we output the idempotency key here?
simonaspiridon
approved these changes
Nov 20, 2026
simonaspiridon
left a comment
Contributor
There was a problem hiding this comment.
LGTM, just one small comment
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.

What does this change?
current issue
Users reporting not seeing the confirmation page after sending alerts (this had been incorreclty fed back to us as them not seeing the confirmation modal with the second "confirm send" button owing to a misunderstanding on terminology).
We have not been able to reproduce this bug, but when the backend returns the success response to the send, the frontend code stores the notification ID in the form state (using the react-form library), then navigates to the confirmation page.
The confirmation page. reads the notification ID from the form state and:
The theory is that the react-form library's setValue function used to store the notifcation ID is not instant/synchronous - so there is a race condition of the value being updated and the page navigating to the confirmation page.
If the app navigates/redirects to the confirmation page before the value is updates, the page will navigate back to the form page - from the user perspective, nothing happened
Fix
Note that we are still using data form the form state in the confirmation page since the new state only contains the ID - we should really be populating this page with the data returned by the server to show what was actually sent, rather than echoing what the user filled out (although the values should be the same if everything worked) but not doing that to avoiad too big a change.
How has this change been tested?
Ran locally so far, but could not previous reproduce the bug before so hard to be sure the fix is comprehensive.
How can we measure success?
No more reports of missing confirmation - or at least reports that they ending up on the history page, not "nothing happend"
Have we considered potential risks?
Should be safe - we have extensive test coverage for the happy path.