Skip to content

Add try/catch around invite member overage modal

Laura Callahan requested to merge 391943-fix_invite_modal_bug into master

What does this MR do and why?

Related to #391943

Throwing an error from an async function doesn't get caught with then/catch method chaining. This is because it's not returning a Promise. Instead, wrap the call in a try/catch.

Failures occurring from the invite API call resulted in the overage modal not handling the error and appearing unresponsive.

Screenshots or screen recordings

Before After
before_change after_change

How to set up and validate locally

-To trigger the original behavior before the fix, use this patch file old_code_error.patch

-To validate with this branch, use this patch file code_fixed_forced_error.patch

  • Or, if you have a QSR premium subscription with limited seats, you can just throw in api.js in inviteGroupMembers
inviteGroupMembers(id, data) {
  throw Error(':(');
  const url = Api.buildUrl(this.groupInvitationsPath).replace(':id', encodeURIComponent(id));

  return axios.post(url, data);
}
  • Navigate to invite group members
  • Click invite members, add someone, then hit continue
  • The overage modal should appear. Hit continue
  • You should be kicked back to the invite modal and the input field should be highlighted in an error state
  • Also smoke test inviting a group

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Laura Callahan

Merge request reports