From 00fa9c5849dfd2b460676a8e0436f43853bdd5db Mon Sep 17 00:00:00 2001 From: Jorge Costa Date: Mon, 11 Mar 2024 17:03:51 +0000 Subject: [PATCH] fix forwardRef view list --- packages/dataviews/src/view-list.js | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/packages/dataviews/src/view-list.js b/packages/dataviews/src/view-list.js index ca6de677b99fd..9fc6246cf7b8b 100644 --- a/packages/dataviews/src/view-list.js +++ b/packages/dataviews/src/view-list.js @@ -6,6 +6,7 @@ import classNames from 'classnames'; /** * WordPress dependencies */ +import { forwardRef } from '@wordpress/element'; import { useAsyncList } from '@wordpress/compose'; import { __experimentalHStack as HStack, @@ -17,17 +18,18 @@ import { ENTER, SPACE } from '@wordpress/keycodes'; import { info } from '@wordpress/icons'; import { __ } from '@wordpress/i18n'; -export default function ViewList( { - view, - fields, - data, - isLoading, - getItemId, - onSelectionChange, - onDetailsChange, - selection, - deferredRendering, -} ) { +const ViewList = forwardRef( ( props, ref ) => { + const { + view, + fields, + data, + isLoading, + getItemId, + onSelectionChange, + onDetailsChange, + selection, + deferredRendering, + } = props; const shownData = useAsyncList( data, { step: 3 } ); const usedData = deferredRendering ? shownData : data; const mediaField = fields.find( @@ -68,7 +70,7 @@ export default function ViewList( { } return ( -