Closed rollo-b2c2 closed 2 weeks ago
I believe the store persists beyond the period when the component is dropped for two reasons. The first reason is found here in the second paragraph, when it says: ...
_"For types that do not need to be dropped, this can enable an even more efficient implementation that does not need to track any additional state."
The other reason I think it persists is because "Static items do not call [drop](https://doc.rust-lang.org/reference/destructors.html) at the end of the program.", but this isn't necessarily the end of the program, right?
If it looks like you'd be worried about losing a store without proper saving or cleanup, there's always ManuallyDrop
provided a fork of the repo implements it on a newtype wrapping the thread local, or something.
This is correct, stores live for the entire application lifetime
I was looking at the implementation of use store and I saw it used a threadlocal to do the global state.
If a component is dismounted, and it’s the only component using a certain store, does the store get dropped?