-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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: improve warning for deprecated equalityFn #1976
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
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 439a73b:
|
Size Change: +268 B (+1%) Total Size: 43.5 kB
ℹ️ View Unchanged
|
if (import.meta.env?.MODE !== 'production' && equalityFn) { | ||
if ( | ||
import.meta.env?.MODE !== 'production' && | ||
equalityFn && | ||
!didWarnAboutEqualityFn | ||
) { | ||
console.warn( | ||
"[DEPRECATED] Use `createWithEqualityFn` from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937" | ||
"[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937" | ||
) | ||
didWarnAboutEqualityFn = true | ||
} |
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.
It may be a good idea to extract this to equalityFn && warnAboutEqualityFnOnce()
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.
Unfortunately, that doesn't work with minification/dead-code-elimination in production.
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.
I see, I don't have any more suggestions then.
I'm still waiting for some 👍 feedback in #1937. |
Related Issues or Discussions
#1937 (reply in thread)
#1937 (reply in thread)
#1937 (comment)
Follow-up #1945
Summary
Improve the warning message based on the feedback.
Check List
yarn run prettier
for formatting code and docs