From 955fcb1bb01a738f1acee4b2f35a95b9cb3e47ef Mon Sep 17 00:00:00 2001 From: teodorus-nathaniel Date: Fri, 15 Dec 2023 18:42:22 +0700 Subject: [PATCH] fix: update grill if address changes --- src/components/chat/ChatIframe.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/chat/ChatIframe.tsx b/src/components/chat/ChatIframe.tsx index aa5609aa..2c458608 100644 --- a/src/components/chat/ChatIframe.tsx +++ b/src/components/chat/ChatIframe.tsx @@ -13,6 +13,7 @@ import { useChatContext } from '../providers/ChatContext' import { isCreatorStakingPage } from '../utils' import { useRouter } from 'next/router' import { getCurrentWallet } from '../utils' +import { useMyAddress } from '../providers/MyExtensionAccountsContext' const creatorsHubId = '1218' @@ -72,6 +73,7 @@ export default function ChatIframe ({ onUnreadCountChange, ...props }: ChatIframeProps) { + const myAddress = useMyAddress() const sendEvent = useSendEvent() const sendEventRef = useWrapInRef(sendEvent) const { spaceId, metadata } = useChatContext() @@ -121,7 +123,8 @@ export default function ChatIframe ({ return () => { if (listener) grill.removeMessageListener(eventListener) } - }, [ spaceId, pathname ]) + // reload grill widget when user changes to update the wallet data + }, [ spaceId, pathname, myAddress ]) return (