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: use-deep-compare-effect #29

Merged
merged 1 commit into from
Oct 19, 2022
Merged

fix: use-deep-compare-effect #29

merged 1 commit into from
Oct 19, 2022

Conversation

missinglink
Copy link
Contributor

@missinglink missinglink commented Oct 19, 2022

resolves #27

the initial values for useDeepCompareEffect (when no additional HTML attributes are set) is equal to [string, nil, nil] which triggers the error mentioned in the GH issue.

the existing code spreads options, meaning it expects an object, this change simply ensures it is always an object, which placates the deps.every(isPrimitive) check in use-deep-compare-effect.

@missinglink
Copy link
Contributor Author

missinglink commented Oct 19, 2022

TBH I'm still a little confused why the production build generated with npm run build works perfectly but the dev build using npm run dev fails.

I went over the scripts/*.js files and they seem to be basically identical, I also can't find anywhere which the environment is defined, either via ENV var or otherwise.

I suspect that it's something to do with error boundaries but don't see where that is defined either 🤷

@missinglink missinglink merged commit 1ca5869 into main Oct 19, 2022
@missinglink missinglink deleted the fix_useDeepCompareEffect branch October 19, 2022 11:04
@missinglink
Copy link
Contributor Author

reviewed by @jedhastwell, thanks Jed! ☕

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.

useDeepCompareEffect should not be used with dependencies that are all primitive
1 participant