Page MenuHomePhabricator

[web] Clear error message before sending another request on settings page
ClosedPublic

Authored by tomek on Jun 29 2022, 9:21 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Jun 27, 3:12 PM
Unknown Object (File)
Thu, Jun 27, 1:09 PM
Unknown Object (File)
Wed, Jun 26, 4:31 AM
Unknown Object (File)
Wed, Jun 26, 4:31 AM
Unknown Object (File)
Wed, Jun 26, 4:31 AM
Unknown Object (File)
Wed, Jun 26, 4:29 AM
Unknown Object (File)
Tue, Jun 25, 3:23 PM
Unknown Object (File)
Mon, Jun 24, 3:37 PM
Subscribers

Details

Summary

When a request is pending we would like to clean the error message so that when a new request fails a user is able to see that this is another request.

Test Plan

Modify update_thread endpoint to fail every second time and check if the UI behaves correctly

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

tomek requested review of this revision.Jun 29 2022, 9:34 AM

Nice, thanks for addressing my inline feedback in D4364. This change looks good and addresses the potential bug.

Just out of curiosity, in your Test Plan you state that you modified the update_thread endpoint to fail every second time. If it's not too much effort, could you explain how you did this? It could help me on some potential testing I'm working on. If not, I can message you offline.

This revision is now accepted and ready to land.Jun 29 2022, 9:35 AM

Just out of curiosity, in your Test Plan you state that you modified the update_thread endpoint to fail every second time. If it's not too much effort, could you explain how you did this? It could help me on some potential testing I'm working on. If not, I can message you offline.

Sure! I simply modified threadUpdateResponder located in thread-responders.js file

let i = 0;
async function threadUpdateResponder(
  viewer: Viewer,
  input: any,
): Promise<ChangeThreadSettingsResult> {
  if (i++ % 2 === 0) {
    throw 'a';
  }
  const request: UpdateThreadRequest = input;
  await validateInput(viewer, updateThreadRequestInputValidator, request);
  return await updateThread(viewer, request);
}

Other testing ideas I used in the past were to e.g. include a delay, include a delay conditionally (e.g. in every second request), throw based on input - it was especially useful when testing sending new messages (every message included a number that indicated how many times a message should retried before being successful). Those are just the ideas - but maybe some of them will inspire you.

This revision now requires review to proceed.Jun 30 2022, 1:26 AM

Ah, thanks! Just using a variable and throwing an exception every second time. Sometimes the simplest solution is the best.

This revision is now accepted and ready to land.Jul 1 2022, 12:25 AM