From f79e489d675cc7a78e262718326782c29bb7002b Mon Sep 17 00:00:00 2001 From: Liam Fitzgerald Date: Sat, 24 Apr 2021 12:23:45 +1000 Subject: [PATCH] ChatResource: prevent unnecessary state update --- pkg/interface/src/views/apps/chat/ChatResource.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/interface/src/views/apps/chat/ChatResource.tsx b/pkg/interface/src/views/apps/chat/ChatResource.tsx index 8fad13168d..e4f02840cd 100644 --- a/pkg/interface/src/views/apps/chat/ChatResource.tsx +++ b/pkg/interface/src/views/apps/chat/ChatResource.tsx @@ -75,7 +75,14 @@ export function ChatResource(props: ChatResourceProps) { ); const clearUnsent = useCallback( - () => setUnsent(s => _.omit(s, station)), + () => { + setUnsent(s => { + if(station in s) { + return _.omit(s, station); + } + return s; + }); + }, [station] );