-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No warning for snapshots in callbacks are not recommended #19
Comments
Thanks for reporting. Hmmm, not sure what's happening. @barelyhuman Are you still around? Can take time to investigate it? |
always here 😂, yeah i’ll check it out |
Thanks for the investigation! Can we check the btw, how does this work? (does lint pass with/without #16?) function useExample0(s: typeof state) {
const snap = useSnapshot(s.a1);
const c = snap.b.c;
useEffect(() => {
if (c === 'a1c') {
state.a1.b.c = 'example';
}
}, [c]);
} this is less error-prone. |
If #16 is disabled It still breaks, but that's been fixed and the lint does warn about the snapshot being used as expected.
So |
I literally coped the example. No eslint warning shows. I'm pretty sure my valtio eslint config is working, since if i write
state.count
in render, it will show a warning from (valtio/state-snapshot-rule).The text was updated successfully, but these errors were encountered: