-
-
Notifications
You must be signed in to change notification settings - Fork 232
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
Support displayName in Scala functional components #1092
Conversation
@@ -13,7 +13,7 @@ object ScalaFnComponentTest extends TestSuite { | |||
|
|||
final case class Add(x: Int, y: Int) | |||
|
|||
val CaseClassProps = ScalaFnComponent[Add] { a => | |||
val CaseClassProps = ScalaFnComponent.withDisplayName("Add")[Add] { a => |
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.
What happens when not setting displayName
? Does it also set the JS facade to ""
? And if so, is this different behaviour than leaving it unset?
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.
If not set, it is taken from an implicit sourcecode.FullName
.
|
||
### New Stuff | ||
|
||
- `ScalaFnComponent` and `ScalaForwardRef` now support `.withDisplayName(name)`. Must be called first (before hooks/`render*`/`withChildren*`). |
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.
Maybe something about the default value?
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.
Good idea 👍
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.
A lot of work to weave the name through everything, but I don't see a simpler alternative. LGTM.
Since this implementation breaks binary compatibility, it would actually imply a major version bump (ie: Seems overkill just for this change, so I'm going to merge this change to our React 18 branch and release this feature there. |
ScalaFnComponent
andScalaForwardRef
now support.withDisplayName(name)
. Must be called first (before hooks/render*
/withChildren*
).Example:
I disabled Mima checks temporarily since this is binary incompatible (it is source compatible though). This implies we have to step up to 2.2.0. We have to reenable Mima tests after 2.2.0 release.This will go into a3.0.0
release, together with React 18 support.Thanks to @hugo-vrijswijk for the idea of using
sourcecode.FullName
for the default names.