From 3a99a79867fc617adfd0b2545df524926cffc48a Mon Sep 17 00:00:00 2001 From: James Acklin Date: Mon, 8 Feb 2021 10:48:29 -0500 Subject: [PATCH] chat: address PR comments Fixes urbit/landscape#303 --- pkg/interface/src/views/components/MentionText.tsx | 9 ++++++--- pkg/interface/src/views/components/OverlaySigil.tsx | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pkg/interface/src/views/components/MentionText.tsx b/pkg/interface/src/views/components/MentionText.tsx index dec08ee58d..bc99a8e2c0 100644 --- a/pkg/interface/src/views/components/MentionText.tsx +++ b/pkg/interface/src/views/components/MentionText.tsx @@ -46,9 +46,12 @@ export function Mention(props: { const group = props.group ?? { hidden: true }; const [showOverlay, setShowOverlay] = useState(false); - const toggleOverlay = () => { - setShowOverlay((value) => !value); - }; + const toggleOverlay = useCallback( + () => { + setShowOverlay(value => !value); + }, + [showOverlay] + ); return ( diff --git a/pkg/interface/src/views/components/OverlaySigil.tsx b/pkg/interface/src/views/components/OverlaySigil.tsx index 24741fce03..f2d031feb8 100644 --- a/pkg/interface/src/views/components/OverlaySigil.tsx +++ b/pkg/interface/src/views/components/OverlaySigil.tsx @@ -72,7 +72,7 @@ export const OverlaySigil = (props: OverlaySigilProps): React.FC => { if (scrollWindow) scrollWindow.removeEventListener('scroll', updateContainerOffset, true); }; - }, []); + }, [scrollWindow]); return ( { contact={contact} group={group} history={history} - onDismiss={() => onDismiss()} + onDismiss={onDismiss} ship={ship} topSpace={space.top} {...rest}