Fix acceptance test

MAILPOET-5949
This commit is contained in:
Oluwaseun Olorunsola
2024-12-09 12:55:32 +01:00
committed by Oluwaseun Olorunsola
parent 36130c9809
commit 08ba9b1da9
3 changed files with 9 additions and 7 deletions

View File

@ -32,13 +32,15 @@ function SelectTemplateBody( {
handleTemplateSelection,
} ) {
const [ selectedCategory, setSelectedCategory ] = useState(
TemplateCategories[ 0 ].name // Show the “Recent” category by default
TemplateCategories[ 1 ].name // Show the “Basic” category by default
);
useEffect( () => {
if ( ! hasEmailPosts ) {
setSelectedCategory( TemplateCategories[ 1 ].name );
}
setTimeout( () => {
if ( hasEmailPosts ) {
setSelectedCategory( TemplateCategories[ 0 ].name );
}
}, 1000 ); // using setTimeout to ensure the template styles are available before block preview
}, [ hasEmailPosts ] );
return (