We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Lets say i have a hook file with a state in it. useAppState.ts
useAppState.ts
export const state = proxy({ isLocked: false, }); export const useAppState = () => { const snap = useSnapshot(state); return { ...snap, state, }; };
File 2 SomeComponent.tsx
SomeComponent.tsx
const { state, isLocked } = useAppState(); const handleClick = () => { console.log(isLocked); // No warning };
Hopefully this can be resolved also, as this will probably lead to hard to catch bugs.
The text was updated successfully, but these errors were encountered:
Hi, thanks for opening this up.
return { ...snap, state, };
That seems like almost impossible to track.
It looks actually fine if isLocked isn't an object.
isLocked
Need better linting for "Snapshots in callbacks are not recommended" when importing another file
Oh, do you mean, it's a false positive?
Sorry, something went wrong.
Hi @dai-shi
Thanks for replying, no it was not false positive. It was detected just fine by eslint, if the state is not imported. don't know why?
e.g.
const state = proxy({ isLocked: false, }); function SomeComponent() { const { isLocked } = useSnapshot(state); const handleClick = () => { console.log(isLocked); // Correct, lint warn }; }
I think maybe not detected because of spreading in other object?
I see. (I misunderstood something in my previous comment.)
Yeah, maybe. Can you try without spreading?
No branches or pull requests
Lets say i have a hook file with a state in it.
useAppState.ts
File 2
SomeComponent.tsx
Hopefully this can be resolved also, as this will probably lead to hard to catch bugs.
The text was updated successfully, but these errors were encountered: