From 95c168b5dbe2650335a6cdf9735348a8c974c15f Mon Sep 17 00:00:00 2001 From: Sebastien Flory Date: Fri, 9 Aug 2024 17:24:36 +0200 Subject: [PATCH] Add: comment about re-rendering cost --- front/components/assistant_builder/InstructionScreen.tsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/front/components/assistant_builder/InstructionScreen.tsx b/front/components/assistant_builder/InstructionScreen.tsx index 921d3b1942c6..44048e34c813 100644 --- a/front/components/assistant_builder/InstructionScreen.tsx +++ b/front/components/assistant_builder/InstructionScreen.tsx @@ -150,6 +150,8 @@ export function InstructionScreen({ const [letterIndex, setLetterIndex] = useState(0); + // Beware that using this useEffect will cause a lot of re-rendering until we finished the visual effect + // We must be careful to avoid any heavy rendering in this component useEffect(() => { if (doTypewriterEffect && editor && builderState.instructions) { // Get the text from content and strip HTML tags for simplicity and being able to write letter by letter