(docs) Memory leak in XState recipe
loganvolkers opened this issue · 1 comments
loganvolkers commented
The XState example recipe contains a memory leak.
Since start()
is called inside of the molecule, but there is no call to stop()
, it creates state that can never be cleaned up.
This was originally reported in #35, but has been split out as it's own issue to make sure we aren't recommending a bad recipe.
This isn’t an issue with jotai or nanostores since they already have a cleanup mechanism, but when working with xstate there's no way to stop the machine, which leads to a memory leak.
Demo of the problem: https://codesandbox.io/s/molecule-cleanup-mvt4cg?file=/App.tsx
loganvolkers commented
Fixed in #44