Skip to content

fix confirmation navigation redirect - #765

Open
dblatcher wants to merge 6 commits into
mainfrom
dblatcher/fix-confirmation-navigation-redirect
Open

dblatcher wants to merge 6 commits into
mainfrom
dblatcher/fix-confirmation-navigation-redirect

Conversation

@dblatcher

@dblatcher dblatcher commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • displays the confirmation if the notification ID is present
  • navigates back to the form page if the notification ID is undefined

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

  1. store the notification ID of the send alert in a separate state using a new context provider, instead of the form state (this seems more logical anyway as the purpose of the form is to store what the users filled out, not the response to what the form posted)
  2. change the redirect on the confirmation to take the user to the history page, not the form page if the notifcation Id is absent - that way, even if (1) doesn't solve the issue, the user will at least not be back on the orm page as if nothign happened

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.

@github-actions

github-actions Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

@dblatcher
dblatcher marked this pull request as ready for review November 20, 2026 11:24
@dblatcher
dblatcher requested a review from a team as a code owner November 20, 2026 11:24
@dblatcher dblatcher linked an issue Nov 20, 2026 that may be closed by this pull request

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we output the idempotency key here?

@simonaspiridon simonaspiridon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one small comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dispatch - fix navigation to confirmation page

4 participants