Closed jsnajdr closed 2 days ago
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot
label.
If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
Co-authored-by: jsnajdr <jsnajdr@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.
It would be nice to get a second opinion, just in case, but it's not a blocker :)
I'm actually taking a look right now.
This is the last
SlotFill
refactor that I originally included in #67000 and later decided to merge one-by-one.The main outcome is refactoring the (base)
Slot
component from a class component to functional. ThecomponentDidMount/DidUpdate
code is converted to auseEffect
. The render code is the same, it just moved from therender()
method to the functional component body.The class version registered its own instance, i.e.,
this
, to the slot registry. But functional components don't have instances likethis
. That's why I'm creating aRenderable
interface with arerender
method, storing a constant per-instance value to a ref, and registering this interface instead.The values in the context that were previously of type
Component< BaseSlotComponentProps >
are nowRerenderable
.It turns out that exactly the same
Renderable
interface is already used by bubbles-virtuallyFill
, so I'm reusing the same code (useForceUpdate
).Last minor update I did is renaming the
SlotFillBubblesVirtuallySlotRef
toSlotRef
, to make the name shorter and prevent the code that uses it from having too many linebreaks.