Skip to content

Commit

Permalink
Remove async useEffect (#40373)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad authored Apr 15, 2022
1 parent ab1ec6f commit e80748e
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export default function UnsavedInnerBlocks( {
);

// Automatically save the uncontrolled blocks.
useEffect( async () => {
useEffect( () => {
// The block will be disabled when used in a BlockPreview.
// In this case avoid automatic creation of a wp_navigation post.
// Otherwise the user will be spammed with lots of menus!
Expand All @@ -150,9 +150,10 @@ export default function UnsavedInnerBlocks( {
}

savingLock.current = true;
const menu = await createNavigationMenu( null, blocks );
onSave( menu );
savingLock.current = false;
createNavigationMenu( null, blocks ).then( ( menu ) => {
onSave( menu );
savingLock.current = false;
} );
}, [
isDisabled,
isSaving,
Expand Down

0 comments on commit e80748e

Please sign in to comment.