Skip to content

Commit

Permalink
Add: comment about re-rendering cost
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraggle committed Aug 9, 2024
1 parent 35fb04f commit 95c168b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions front/components/assistant_builder/InstructionScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 95c168b

Please sign in to comment.