From 4b933f74d3964975dba9c0ee9c8b82645566cdaa Mon Sep 17 00:00:00 2001 From: Mayank-Tripathi32 Date: Thu, 9 Jan 2025 23:05:31 +0530 Subject: [PATCH] feat: fixed console warning for ref to disabled component --- .../src/navigation/edit/unsaved-inner-blocks.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/navigation/edit/unsaved-inner-blocks.js b/packages/block-library/src/navigation/edit/unsaved-inner-blocks.js index 6cdcaa46f2bac3..bbf51e1323efd5 100644 --- a/packages/block-library/src/navigation/edit/unsaved-inner-blocks.js +++ b/packages/block-library/src/navigation/edit/unsaved-inner-blocks.js @@ -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 ( + +
+ + ); + } - return ; + return
; }