Skip to content

Commit 7fa8d68

Browse files
debangshu919masenf
andauthored
Apply suggestions from code review
Thanks for the suggestions! Co-authored-by: Masen Furer <[email protected]>
1 parent b9d2f1f commit 7fa8d68

File tree

1 file changed

+5
-3
lines changed
  • reflex/.templates/web/utils/helpers

1 file changed

+5
-3
lines changed

reflex/.templates/web/utils/helpers/paste.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,15 @@ export default function usePasteHandler(target_ids, event_actions, on_paste) {
4040

4141
useEffect(() => {
4242
onPasteRef.current = on_paste;
43+
}, [on_paste])
44+
useEffect(() => {
4345
eventActionsRef.current = event_actions;
44-
});
46+
}, [event_actions]);
4547

4648
useEffect(() => {
4749
const handle_paste = (_ev) => {
48-
eventActionsRef.current.preventDefault && _ev.preventDefault();
49-
eventActionsRef.current.stopPropagation && _ev.stopPropagation();
50+
eventActionsRef.current?.preventDefault && _ev.preventDefault();
51+
eventActionsRef.current?.stopPropagation && _ev.stopPropagation();
5052
handle_paste_data(_ev.clipboardData).then(onPasteRef.current);
5153
};
5254

0 commit comments

Comments
 (0)