Skip to content
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

Merged
merged 3 commits into from
Jun 10, 2024
Merged

Fix: simplify check for supported hooks #48

merged 3 commits into from
Jun 10, 2024

Conversation

barelyhuman
Copy link
Collaborator

Closes #47

Copy link

github-actions bot commented Apr 13, 2024

Size Change: +30 B (+0.73%)

Total Size: 4.17 kB

Filename Size Change
dist/index.js 4.17 kB +30 B (+0.73%)

compressed-size-action

@barelyhuman barelyhuman marked this pull request as draft April 13, 2024 13:19
@barelyhuman barelyhuman self-assigned this Apr 13, 2024
@barelyhuman barelyhuman marked this pull request as ready for review May 27, 2024 17:52
Comment on lines +309 to +314
const foo = proxy({ foo: 123 });
function useExample2(s) {
const val = useMemo(()=>{
return foo.foo
},[foo.foo])
}`,
Copy link
Member

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])
  }

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Comment on lines +302 to +307
function useExample2(s) {
const {b: {c} } = useSnapshot(s.a1);
const val = useMemo(()=>{
return s.a1.b.c
},[s.a1.b.c])
}`,
Copy link
Member

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])
  }

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

Copy link
Member

@dai-shi dai-shi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@barelyhuman barelyhuman merged commit 0de1db9 into main Jun 10, 2024
4 of 5 checks passed
@barelyhuman barelyhuman deleted the fix/47 branch June 10, 2024 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adjust rule for Valtio v2
2 participants