Skip to content

Commit

Permalink
feat: fixed console warning for ref to disabled component
Browse files Browse the repository at this point in the history
  • Loading branch information
Mayank-Tripathi32 committed Jan 9, 2025
1 parent e746a95 commit 4b933f7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/block-library/src/navigation/edit/unsaved-inner-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,15 @@ export default function UnsavedInnerBlocks( {
hasSelection,
] );

const Wrapper = isSaving ? Disabled : 'div';
if ( isSaving ) {
// We will get an error (Function components cannot be given refs) if we pass ref to Disabled component.
// So we need to to pass it to the inner div.
return (
<Disabled>
<div { ...innerBlocksProps } />
</Disabled>
);
}

return <Wrapper { ...innerBlocksProps } />;
return <div { ...innerBlocksProps } />;
}

0 comments on commit 4b933f7

Please sign in to comment.