-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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(frontend): Better CopyToClipboardInline
typing
#18723
Conversation
101b948
to
4e74462
Compare
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
Size Change: 0 B Total Size: 2.01 MB ℹ️ View Unchanged
|
📸 UI snapshots have been updated2 snapshot changes in total. 0 added, 2 modified, 0 deleted:
Triggered by this commit. |
📸 UI snapshots have been updated1 snapshot changes in total. 0 added, 1 modified, 0 deleted:
Triggered by this commit. |
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.
Lovely stuff!
CopyToClipboardInline
typig instead of errorsCopyToClipboardInline
typing instead of errors
CopyToClipboardInline
typing instead of errorsCopyToClipboardInline
typing
Problem
Throwing errors rarely is a good idea in React components… yet that's what I did in #18662 within
CopyToClipboardInline
to prevent un-copyable values from being presented as copyable (primarily objects, whoseString()
representation is "[object Object]"). This did prevent that, but also crashed the offending scene, which is too drastic.Changes
This PR does the right thing, which is narrowing down the component's type to prevent this at compile time. Mostly, because we still allow an implicit conversion from
any
-typed values, which can be bad. That'sPropertiesTable
, which I looked at manually – it now allows copying any value, because non-strings we can easilyJSON.stringify()
.How did you test this code?
Added visual regression test.