Skip to content

Fix async error handling in DispatchIncidentButton: await newIncidentDispatchAction dispatch#4097

Merged
stephenhand merged 2 commits intoCHI-3647-fix_componentfrom
copilot/sub-pr-4095
Mar 26, 2026
Merged

Fix async error handling in DispatchIncidentButton: await newIncidentDispatchAction dispatch#4097
stephenhand merged 2 commits intoCHI-3647-fix_componentfrom
copilot/sub-pr-4095

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 26, 2026

newIncidentDispatchAction is an async action that performs network calls. Without await, the success notification was shown immediately regardless of outcome, and async failures escaped the try/catch block, potentially surfacing as unhandled promise rejections.

Description

Added await before dispatching newIncidentDispatchAction so that:

  • Success notification only fires after the action fully resolves
  • Failures are caught by the existing try/catch and show the error notification
// Before
dispatch(newIncidentDispatchAction(savedContact));
Notifications.showNotificationSingle(dispatchSuccessNotification);

// After
await dispatch(newIncidentDispatchAction(savedContact));
Notifications.showNotificationSingle(dispatchSuccessNotification);

Checklist

  • Corresponding issue has been opened
  • New tests added
  • Feature flags added
  • Strings are localized
  • Tested for chat contacts
  • Tested for call contacts

Other Related Issues

None

Verification steps

  1. Open a USCR contact with an associated case
  2. Fill in required form fields and click Dispatch Incident
  3. Confirm success notification only appears after the network call completes
  4. Simulate a network failure and confirm the error notification appears instead of the success notification

AFTER YOU MERGE

  1. Cut a release tag using the Github workflow. Wait for it to complete and notify in the #aselo-deploys Slack channel.
  2. Comment on the ticket with the release tag version AND any additional instructions required to configure an environment to test the changes.
  3. Only then move the ticket into the QA column in JIRA

You are responsible for ensuring the above steps are completed. If you move a ticket into QA without advising what version to test, the QA team will assume the latest tag has the changes. If it does not, the following confusion is on you! :-P


📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

…nly shown on success and errors propagate to catch block

Co-authored-by: stephenhand <1694716+stephenhand@users.noreply.github.com>
Agent-Logs-Url: https://github.com/techmatters/flex-plugins/sessions/8ff858da-fa0e-4668-bc0f-ba268cb2ea83
Copilot AI changed the title [WIP] [WIP] Address feedback on CHI-3647: Update EditCaseOverview component changes Fix async error handling in DispatchIncidentButton: await newIncidentDispatchAction dispatch Mar 26, 2026
Copilot AI requested a review from stephenhand March 26, 2026 09:04
Copy link
Copy Markdown
Collaborator

@stephenhand stephenhand left a comment

Choose a reason for hiding this comment

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

Use asyncDispatch

@stephenhand stephenhand marked this pull request as ready for review March 26, 2026 10:02
@stephenhand stephenhand merged commit df5f963 into CHI-3647-fix_component Mar 26, 2026
26 checks passed
@stephenhand stephenhand deleted the copilot/sub-pr-4095 branch March 26, 2026 10:18
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.

2 participants