Replies: 1 comment 2 replies
-
I'm not an eslint plugin expert, but I believe it's possible to at least check that functions passed to I just spent a few minutes prompting claude to do this. I think it's close, though its tests aren't passing. Not sure how much more effort it'll take. @david-trumid what do you think? It sounds like something we could benefit from. I'm not sure how hard it is. There is another approach we're considering that would indirectly address this: Proxy exports that allow the underlying references to change while keeping the references consumers access stable. I think that would be a more robust solution than an eslint plugin, though we'd have to investigate whether the tradeoffs are worth it. |
Beta Was this translation helpful? Give feedback.
-
While using zedux over the course of several months, I've found that the main bugs I've hit are related to closing over stale state with
injectPromise
or exports. As it's probably not possible to represent in the TS type system, and is perhaps even a feature to read the "snapshotted" data, could zedux provide an opt-in eslint rule that detects usages where the state would be "static" relative to the execution of the atom, so that the user can annotate places where the intention is to close over the initial value versus the likely intended behavior of keeping the value reactive?This can be pivotal to an app's logic, such as switching users or profiles (and have serious security implications), or some global setting that all other data is parameterized by. It's a common footgun in my experience to accidentally close over the value of an
injectAtomValue
, thinking it will be reactive, but missing it in a dependency array, or not usinginjectAtomGetters
to get the up-to-update value.Beta Was this translation helpful? Give feedback.
All reactions