-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
SlotFill
: Pass Component
instance to unregisterSlot.
#54765
SlotFill
: Pass Component
instance to unregisterSlot.
#54765
Conversation
Component
instance to unregisterSlot.SlotFill
: Pass Component
instance to unregisterSlot.
Size Change: -2 B (0%) Total Size: 1.62 MB
ℹ️ View Unchanged
|
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 🚀 Thanks!
@@ -47,7 +47,7 @@ class SlotComponent extends Component { | |||
const { name, unregisterSlot, registerSlot } = this.props; | |||
|
|||
if ( prevProps.name !== name ) { | |||
unregisterSlot( prevProps.name ); | |||
unregisterSlot( prevProps.name, this ); |
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 be a good one to have a unit test for 🤔
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.
Agreed with @tyxla — let's add a unit test, and then this PR is good to merge!
@@ -47,7 +47,7 @@ class SlotComponent extends Component { | |||
const { name, unregisterSlot, registerSlot } = this.props; | |||
|
|||
if ( prevProps.name !== name ) { | |||
unregisterSlot( prevProps.name ); | |||
unregisterSlot( prevProps.name, this ); |
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.
Agreed with @tyxla — let's add a unit test, and then this PR is good to merge!
What?
part of #51350.
#51350 (comment)
When the slot name is updated, unregisterSlot is executed and the instance is unregistered, but it is not working correctly because the component instance is not passed. Fix this issue.
Why?
bug fix.
How?
add
this
.Testing Instructions