Page MenuHomePhabricator

[web] modify useOnClickReact to return function with arguments instead of passing arguments directly into hook
ClosedPublic

Authored by ginsu on Jan 26 2023, 11:53 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Sep 19, 8:48 AM
Unknown Object (File)
Thu, Sep 19, 8:48 AM
Unknown Object (File)
Thu, Sep 19, 8:47 AM
Unknown Object (File)
Thu, Sep 19, 8:47 AM
Unknown Object (File)
Thu, Sep 19, 8:42 AM
Unknown Object (File)
Wed, Sep 11, 12:43 AM
Unknown Object (File)
Fri, Sep 6, 1:26 AM
Unknown Object (File)
Sun, Sep 1, 5:28 PM
Subscribers

Details

Summary

modify useOnClickReact to return function with arguments instead of passing arguments directly into hook. This change will be necesary when we introduce the emoji keyboard, and we will need to pass the reactionInput through a useCallback hook


Depends on D6399
Linear Task: ENG-2776

Test Plan

flow, this will be further tested in a subsequent diff, and no regressions found when tested with plain message liking

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Would we be able to pass all the arguments directly to the hook except the reactionInput? Personally feel like that would be a cleaner API

web/chat/reaction-message-utils.js
40 ↗(On Diff #21385)

Is it okay to remove the preventDefault() here? Doesn't look like it's being used elsewhere.

This revision is now accepted and ready to land.Jan 27 2023, 1:12 PM

address atul's comments

web/chat/reaction-message-utils.js
40 ↗(On Diff #21385)

Yea, it's not being used elsewhere, and it will be irrelevant in the next diff in this stack

Would we be able to pass all the arguments directly to the hook except the reactionInput?

Was able to pass all the arguments directly except for action. This is because action uses reactionInput to figure out whether to add_reaction or remove_reaction so they need to be together