From e3e3445b93c7706f2818478dda60316f09afaaf4 Mon Sep 17 00:00:00 2001 From: Peter Cai Date: Thu, 20 Feb 2020 10:35:18 +0800 Subject: [PATCH] pastebin: use more useCallback here to reduce re-rendering --- src/web/pastebin.coffee | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/web/pastebin.coffee b/src/web/pastebin.coffee index 6a5db3e..b5ce279 100644 --- a/src/web/pastebin.coffee +++ b/src/web/pastebin.coffee @@ -17,9 +17,15 @@ export default Pastebin = -> onEditTextUpdate = (ev) -> setText ev.target.value + # onEditTextUpdate depends on absolutely nothing for reading + onEditTextUpdate = useCallback onEditTextUpdate, [] paste = -> + # We force a single file name and mime type on web-pasted content doPaste "web_paste.txt", "text/plain", text + # Paste depends only on the actual text + # and of course the function doPaste + paste = useCallback paste, [text, doPaste]
{renderDialog()}