Page MenuHomePhabricator

[web] introduce useOnClickReact hook in reaction message utils
ClosedPublic

Authored by ginsu on Dec 27 2022, 7:21 AM.
Tags
None
Referenced Files
F3375125: D6055.diff
Tue, Nov 26, 6:27 PM
Unknown Object (File)
Wed, Nov 20, 4:48 AM
Unknown Object (File)
Sun, Nov 10, 7:51 AM
Unknown Object (File)
Sat, Nov 9, 11:57 PM
Unknown Object (File)
Fri, Nov 8, 5:15 PM
Unknown Object (File)
Fri, Nov 8, 5:15 PM
Unknown Object (File)
Fri, Nov 8, 5:15 PM
Unknown Object (File)
Fri, Nov 8, 5:15 PM
Subscribers

Details

Summary

intorduce useOnClickReact hook. useOnClickReact is the web implmentation of the similar function onPressReact introduced in D5780. This function handles the calling of the create reaction message endpoint and then dispatching the results of that to the reducer


Linear Task: ENG-2473

Depends on D6054

Test Plan

This task will be futher tested in subsequent diffs. I was also able to like/unlike messages in web in my local stack using this hook and some subsequent diffs

Additionally, here is what the Alert looks like if a message fails to go through

Screenshot 2022-12-28 at 12.11.26 PM.png (2×3 px, 1 MB)

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

ginsu requested review of this revision.Dec 27 2022, 7:35 AM
web/chat/reaction-message-utils.js
42 ↗(On Diff #20188)

On web we usually use pushModal instead and show something like eg. ConcurrentModificationModal. We don't currently have any usages of alert in the web codebase

Can you either:

  1. Attach some videos of what this looks like in Chrome, Firefox, Safari
  2. Or update it to match existing web conventions

Not trying to slow you down but I think we should think this through

web/chat/reaction-message-utils.js
42 ↗(On Diff #20188)

Not trying to slow you down but I think we should think this through

No definitely this is a good shout. Just updated the test plan to show what alerts look like in Chrome, Firefox and Safari. If we don't think alerts are a good user experience, will be happy to update the code based off the existing web conventions

Safari looks good but the others look really bad... I think we should probably stick with the current pattern

Safari looks good but the others look really bad... I think we should probably stick with the current pattern

Gotcha I can definitely do that

Making changes to improve the error alert

updated alert to use in house Alert component

ashoat requested changes to this revision.Dec 28 2022, 5:18 PM
ashoat added inline comments.
web/chat/reaction-message-utils.js
51

We should still throw e... otherwise we implicitly return undefined (wish we had an ESLint rule that forced these to be explicit), and as a result will dispatch a _SUCCESS action with an undefined action.payload, instead of a _FAILED action with the exception info

This revision now requires changes to proceed.Dec 28 2022, 5:18 PM

address ashoat's comments

Resigning to unblock since this was approved by @ashoat.

This revision is now accepted and ready to land.Dec 29 2022, 12:49 PM