jstejada / react-typist

Typing animations with React
https://jstejada.github.io/react-typist/
Other
1.4k stars 124 forks source link

Memory Leak due to Backspace after unmounting #86

Open jrios6 opened 4 years ago

jrios6 commented 4 years ago

I am receiving the following memory leak warning after unmounting a parent container that uses Typist and Typist.Backspace. I presume that this is due to Typist.Backspace's async function still running even after unmount.

Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.

georgeportillo commented 4 years ago

Same here

khaaleoo commented 4 years ago

the same question

navonf commented 4 years ago

I am also receiving this error

vorobiovart commented 4 years ago

I think the temp solution for this situation would be not to set delay on Typist.Backspace, but instead use Typist.Delay before, like this:

working without memory leaks:

  <Typist.Delay ms={1100} />
  <Typist.Backspace count={name.length} />

working with leaks:

<Typist.Backspace count={name.length}  delay={1100} />