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)
Mon, Dec 16, 5:18 PM
Unknown Object (File)
Mon, Dec 16, 10:03 AM
Unknown Object (File)
Mon, Dec 16, 10:03 AM
Unknown Object (File)
Mon, Dec 16, 10:03 AM
Unknown Object (File)
Sun, Dec 15, 5:24 AM
Unknown Object (File)
Sat, Dec 7, 5:11 PM
Unknown Object (File)
Nov 9 2024, 7:49 AM
Unknown Object (File)
Oct 24 2024, 11:28 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