-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: Refactor <Slot bubblesVirtually />
#53272
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,12 +13,20 @@ import { useMergeRefs } from '@wordpress/compose'; | |
/** | ||
* Internal dependencies | ||
*/ | ||
import { View } from '../../view'; | ||
import SlotFillContext from './slot-fill-context'; | ||
|
||
function Slot( | ||
{ name, fillProps = {}, as: Component = 'div', ...props }, | ||
forwardedRef | ||
) { | ||
function Slot( props, forwardedRef ) { | ||
const { | ||
name, | ||
fillProps = {}, | ||
as, | ||
// `children` is not allowed. However, if it is passed, | ||
// it will be displayed as is, so remove `children`. | ||
children, | ||
...restProps | ||
} = props; | ||
|
||
const { registerSlot, unregisterSlot, ...registry } = | ||
useContext( SlotFillContext ); | ||
const ref = useRef(); | ||
|
@@ -41,7 +49,11 @@ function Slot( | |
} ); | ||
|
||
return ( | ||
<Component ref={ useMergeRefs( [ forwardedRef, ref ] ) } { ...props } /> | ||
<View | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need to use the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jsnajdr Thanks. In the original Pull Request, I changed to View to avoid There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see, so it's not because of |
||
as={ as } | ||
ref={ useMergeRefs( [ forwardedRef, ref ] ) } | ||
{ ...restProps } | ||
/> | ||
); | ||
} | ||
|
||
|
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.
@torounit Just noticed that this PR removed a CHANGELOG entry — was that on purpose? If not, could you add it back (maybe as part of #51350) ?
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.
This is a mistake. Commit to PR #51350.