Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: BlockList uses Hooks #50293

Merged
merged 11 commits into from
May 8, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,23 @@ import { View } from 'react-native';
* WordPress dependencies
*/
import { useEffect, useCallback } from '@wordpress/element';
import { useSelect } from '@wordpress/data';

/**
* Internal dependencies
*/
import { useBlockListContext } from './block-list-context';
import { store as blockEditorStore } from '../../store';

function BlockListItemCell( { children, clientId, rootClientId, onLayout } ) {
function BlockListItemCell( { children, item: clientId, onLayout } ) {
const { blocksLayouts, updateBlocksLayouts } = useBlockListContext();
const { rootClientId } = useSelect(
( select ) => {
const { getBlockRootClientId } = select( blockEditorStore );
return { rootClientId: getBlockRootClientId( clientId ) };
},
[ clientId ]
);
geriux marked this conversation as resolved.
Show resolved Hide resolved

useEffect( () => {
return () => {
Expand Down
Loading