Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33305020
D6401.1768789365.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D6401.1768789365.diff
View Options
diff --git a/web/chat/reaction-message-utils.js b/web/chat/reaction-message-utils.js
--- a/web/chat/reaction-message-utils.js
+++ b/web/chat/reaction-message-utils.js
@@ -23,9 +23,7 @@
messageID: ?string,
localID: string,
threadID: string,
- reaction: string,
- action: 'add_reaction' | 'remove_reaction',
-): (event: SyntheticEvent<HTMLElement>) => mixed {
+): (reaction: string, action: 'add_reaction' | 'remove_reaction') => mixed {
const { pushModal } = useModalContext();
const viewerID = useSelector(
@@ -36,9 +34,7 @@
const dispatchActionPromise = useDispatchActionPromise();
return React.useCallback(
- (event: SyntheticEvent<HTMLElement>) => {
- event.preventDefault();
-
+ (reaction, action) => {
if (!messageID) {
return;
}
@@ -95,11 +91,9 @@
},
[
messageID,
+ viewerID,
threadID,
localID,
- viewerID,
- reaction,
- action,
dispatchActionPromise,
callSendReactionMessage,
pushModal,
diff --git a/web/utils/tooltip-utils.js b/web/utils/tooltip-utils.js
--- a/web/utils/tooltip-utils.js
+++ b/web/utils/tooltip-utils.js
@@ -466,13 +466,12 @@
const viewerReacted = !!reactions.get(reactionInput)?.viewerReacted;
const action = viewerReacted ? 'remove_reaction' : 'add_reaction';
- const onClickReact = useOnClickReact(
- messageInfo.id,
- localID,
- threadInfo.id,
- reactionInput,
+ const onClickReact = useOnClickReact(messageInfo.id, localID, threadInfo.id);
+
+ const onClick = React.useCallback(() => onClickReact(reactionInput, action), [
action,
- );
+ onClickReact,
+ ]);
const canCreateReactionFromMessage = useCanCreateReactionFromMessage(
threadInfo,
@@ -490,10 +489,10 @@
return {
actionButtonContent: buttonContent,
- onClick: onClickReact,
+ onClick,
label: viewerReacted ? 'Unlike' : 'Like',
};
- }, [canCreateReactionFromMessage, onClickReact, viewerReacted]);
+ }, [canCreateReactionFromMessage, onClick, viewerReacted]);
}
function useMessageTooltipActions(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Jan 19, 2:22 AM (8 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5953502
Default Alt Text
D6401.1768789365.diff (2 KB)
Attached To
Mode
D6401: [web] modify useOnClickReact to return function with arguments instead of passing arguments directly into hook
Attached
Detach File
Event Timeline
Log In to Comment