From 9213dd33feb1656ed4716f1138df1b27e48ad9dc Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Wed, 11 May 2022 10:21:26 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8A=20Log=20incoming=20data=20to=20inv?= =?UTF-8?q?estigate=20inconsistency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../contexts/TypebotContext/TypebotContext.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/apps/builder/contexts/TypebotContext/TypebotContext.tsx b/apps/builder/contexts/TypebotContext/TypebotContext.tsx index 7a59b977c..3e99c19c3 100644 --- a/apps/builder/contexts/TypebotContext/TypebotContext.tsx +++ b/apps/builder/contexts/TypebotContext/TypebotContext.tsx @@ -161,6 +161,13 @@ export const TypebotContext = ({ useEffect(() => { if (!typebot || !currentTypebotRef.current) return + if ( + dequal( + omit(typebot, 'updatedAt'), + omit(currentTypebotRef.current, 'updatedAt') + ) + ) + return if (typebotId !== currentTypebotRef.current.id) { setLocalTypebot({ ...typebot }) flush() @@ -168,6 +175,12 @@ export const TypebotContext = ({ new Date(typebot.updatedAt) > new Date(currentTypebotRef.current.updatedAt) ) { + console.log( + 'Incoming typebot', + typebot, + 'Current typebot', + currentTypebotRef.current + ) setLocalTypebot({ ...typebot }) }