Skip to content
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

Refactor appender to use the render function instead of a component instance #29911

Open
wants to merge 23 commits into
base: trunk
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4fa0466
Refactor appender to use the render funcition instead of a component …
renatho Mar 16, 2021
1e22c09
Refactor to have backward compatibility
renatho Mar 17, 2021
de24af1
Refactor InnerBlocks to use a new prop appender
renatho May 14, 2021
2233661
Update to show warning also when setting false to the renderAppender
renatho May 14, 2021
f31075a
Update appender documentation
renatho May 14, 2021
9f70957
Refactor tests and components using renderAppender
renatho May 14, 2021
774e10f
Refactor React Native InnerBlocks to use appender prop
renatho May 14, 2021
da1f9f9
Update to support appender false in react native
renatho May 21, 2021
682b6be
Fix defaul block appender component
renatho May 21, 2021
dd4ddcd
Update renderAppender deprecation message
renatho May 21, 2021
065f2d3
Add renderAppender deprecation to changelog
renatho May 21, 2021
659fb1e
Update to reproduce the previous behavior
renatho May 29, 2021
632b671
Fix InnerBlocks appender tests
renatho May 29, 2021
7071490
Update deprecation version
renatho Jul 5, 2021
822cb26
Refactor to use fallback only when appender is `null`
renatho Jul 6, 2021
d10c013
Refactor appender to return null with any falsy value but undefined
renatho Jul 8, 2021
cf47a99
Fix new component appender prop
renatho Jul 13, 2021
757ab74
Revert yoda contitions
renatho Jul 14, 2021
96a0908
Update appender checks
renatho Jul 14, 2021
684a4e5
Simplify some checks
renatho Jul 14, 2021
828d32e
Update deprecated version
renatho Jul 14, 2021
47d75b9
Update deprecation versions
renatho Aug 20, 2021
b67f39e
Update components to use appender prop instead of deprecated renderAp…
renatho Aug 20, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Refactor appender to use the render funcition instead of a component …
…instance
  • Loading branch information
renatho committed Sep 8, 2021
commit 4fa04669650e5d9a77507cf8b9aaf016a3c21967
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,17 @@ function BlockListAppender( {
rootClientId,
canInsertDefaultBlock,
isLocked,
renderAppender: CustomAppender,
renderAppender,
className,
selectedBlockClientId,
tagName: TagName = 'div',
} ) {
if ( isLocked || CustomAppender === false ) {
if ( isLocked || renderAppender === false ) {
return null;
}

let appender;
if ( CustomAppender ) {
// Prefer custom render prop if provided.
appender = <CustomAppender />;
} else {
if ( ! renderAppender ) {
const isDocumentAppender = ! rootClientId;
const isParentSelected = selectedBlockClientId === rootClientId;
const isAnotherDefaultAppenderAlreadyDisplayed =
Expand Down Expand Up @@ -88,7 +85,7 @@ function BlockListAppender( {
className
) }
>
{ appender }
{ renderAppender ? renderAppender() : appender }
</TagName>
);
}
Expand Down