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)
Sat, Dec 7, 12:18 AM
Unknown Object (File)
Tue, Dec 3, 1:35 PM
Unknown Object (File)
Nov 12 2024, 11:01 PM
Unknown Object (File)
Nov 10 2024, 1:37 PM
Unknown Object (File)
Nov 10 2024, 12:37 PM
Unknown Object (File)
Nov 1 2024, 12:59 PM
Unknown Object (File)
Nov 1 2024, 12:59 PM
Unknown Object (File)
Nov 1 2024, 12:59 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