Remove unnecessary early return in the RichTextWithButton component

MAILPOET-6431
This commit is contained in:
Oluwaseun Olorunsola
2025-02-12 21:18:48 +01:00
committed by Oluwaseun Olorunsola
parent ee513fd871
commit f96e74cf96
4 changed files with 6 additions and 6 deletions

View File

@@ -18,7 +18,7 @@ type Replacement = {
function getChildElement( rootElement: HTMLElement ): HTMLElement | null {
let currentElement: HTMLElement | null = rootElement;
while ( currentElement && currentElement.children.length > 0 ) {
while ( currentElement && currentElement?.children?.length > 0 ) {
// Traverse into the first child element
currentElement = currentElement.children[ 0 ] as HTMLElement;
}

View File

@@ -97,13 +97,13 @@ export function RichTextWithButton( {
</>
);
if ( ! attributeValue ) {
if ( ! attributeName ) {
return null;
}
return (
<BaseControl
id=""
id="" // See https://github.com/mailpoet/mailpoet/pull/6089#discussion_r1952126850 to understand why the ID is empty
label={ finalLabel }
className={ `mailpoet-settings-panel__${ attributeName }-text` }
help={ help }