-
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
Fix: simplify check for supported hooks #48
Conversation
Size Change: +30 B (+0.73%) Total Size: 4.17 kB
|
const foo = proxy({ foo: 123 }); | ||
function useExample2(s) { | ||
const val = useMemo(()=>{ | ||
return foo.foo | ||
},[foo.foo]) | ||
}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to that, this is valid too.
const foo = proxy({ foo: 123 });
function useExample2(s) {
const val = useMemo(()=>{
return foo.foo
},[foo])
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
function useExample2(s) { | ||
const {b: {c} } = useSnapshot(s.a1); | ||
const val = useMemo(()=>{ | ||
return s.a1.b.c | ||
},[s.a1.b.c]) | ||
}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's actually not good.
The deps should come from snapshots.
function useExample2(s) {
const {b: {c} } = useSnapshot(s.a1);
const val = useMemo(()=>{
return c
},[c])
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closes #47