Skip to content

Fix interval cleanup in typewriter text#1

Open
AlexandreGaubert wants to merge 1 commit into
masterfrom
codex/gérer-setinterval-avec-useref-et-useeffect

Hidden character warning

The head ref may contain hidden characters: "codex/g\u00e9rer-setinterval-avec-useref-et-useeffect"
Open

Fix interval cleanup in typewriter text#1
AlexandreGaubert wants to merge 1 commit into
masterfrom
codex/gérer-setinterval-avec-useref-et-useeffect

Conversation

@AlexandreGaubert
Copy link
Copy Markdown
Owner

Summary

  • store the interval ID with useRef
  • clear the interval on component unmount

Testing

  • yarn test --watchAll=false (fails: package not present in lockfile)

https://chatgpt.com/codex/tasks/task_e_6840855a068c832397b6ed2bd3512d4d

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes how the interval is managed in the typewriter text component by storing the interval ID in a ref and properly clearing it on component unmount.

  • Removed the useCallback hook and now using a plain function for creating the interval.
  • Introduced an intervalRef to store the interval ID and added a cleanup function in useEffect.
Comments suppressed due to low confidence (1)

src/components/reusable/TypewritterText/TypewritterText.tsx:9

  • The component function is named 'TypewriterText' but the file and directory use 'TypewritterText'. Consider renaming either the component or the file/directory to maintain a consistent naming convention.
export default function TypewriterText({ texts, color }: Props) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants