-
-
Notifications
You must be signed in to change notification settings - Fork 614
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(core): atom toString includes debugLabel in dev mode #2659
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. |
Preview in LiveCodesLatest commit: 8fe2a7c
See documentations for usage instructions. |
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
As this conflicts with jotai-devtools hook behavior, can you open a PR there too?
We may need to coordinate the release timing, but the behavioral change is trivial, so we don't need to care much. cc @arjunvegda
|
toString: () => key, | ||
toString() { | ||
return import.meta.env?.MODE !== 'production' && this.debugLabel | ||
? key + ':' + this.debugLabel |
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.
Curious - why add a key with :
here if a debugLabel
is present? 🤔 Is it to avoid naming collisions?
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.
Could it be to make similar with useAtomsDevtools.ts#L12?
If we are going to centralize / change logic for useAtomsDevtools.ts#L12 anyways, then does it make sense to consider a different delimiter instead?
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.
@arjunvegda toString must return a unique string as the use case is key={}
in React. debugLabel doesn't have to be unique. So, yes, it's to avoid collisions.
Size Change: +111 B (+0.13%) Total Size: 86.9 kB
ℹ️ View Unchanged
|
Summary
Check List
pnpm run prettier
for formatting code and docs