vobyjs / voby

A high-performance framework with fine-grained observable/signal-based reactivity for building rich applications.
https://voby.dev
MIT License
891 stars 22 forks source link

Prevent closure variables caching issue #9

Closed Mati365 closed 2 years ago

Mati365 commented 2 years ago

https://github.com/vobyjs/voby/blob/d685d6079bb0172339d26535a551842545c70ab3/src/hooks/use_timeout.ts#L15

Maybe it will be better to use there (and in other places) "safe closure" approach? It is described here: https://dmitripavlutin.com/react-hooks-stale-closures/

fabiospampinato commented 2 years ago

How do you propose that code should be changed? And I guess what would that change bring to the table?

fabiospampinato commented 2 years ago

Happy to reopen once a material suggestion is made.