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/19 #20

Merged
merged 4 commits into from
Apr 13, 2022
Merged

Fix/19 #20

merged 4 commits into from
Apr 13, 2022

Conversation

barelyhuman
Copy link
Collaborator

@barelyhuman barelyhuman commented Apr 13, 2022

Changes

  • Add check for VariableDeclaration being the caller with the snapshot inside
  • Check if the read snapshot is a member of the dependencies when being used in useEffect and useCallback

Fix: #19

this is needed for cases where the
function might be declared
as
```
const handler = ()=>{}
```
adds tests, utils and implementation
to skip the check if the used snapshot
item is  a part of the hook's dependencies
@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 13, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 60e6cf1:

Sandbox Source
Vanilla Configuration
React Configuration

@barelyhuman
Copy link
Collaborator Author

@dai-shi any more testcases that you might want me to add?

@barelyhuman
Copy link
Collaborator Author

Action failed to commit cause external PR

Filename Size Change
dist/index.js 3.08 kB +422 B (+16%) ⚠️

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
Thanks for your work!!

tests/StateSnapshot.test.js Outdated Show resolved Hide resolved
@dai-shi dai-shi merged commit f4f93ae into pmndrs:main Apr 13, 2022
@barelyhuman barelyhuman deleted the fix/19 branch April 13, 2022 08:54
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.

No warning for snapshots in callbacks are not recommended
2 participants