Skip to content

Commit

Permalink
Revert changes to useBlockElement
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix authored and youknowriad committed May 19, 2021
1 parent 1ea9cd6 commit a07718b
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ function useBlockRef( clientId ) {
*/
function useBlockElement( clientId ) {
const { callbacks } = useContext( BlockRefs );
const [ element, setElement ] = useState( useBlockRef( clientId ).current );
const ref = useBlockRef( clientId );
const [ element, setElement ] = useState( null );

useLayoutEffect( () => {
if ( ! clientId ) {
Expand All @@ -106,7 +107,7 @@ function useBlockElement( clientId ) {
};
}, [ clientId ] );

return element;
return ref.current || element;
}

export { useBlockRef as __unstableUseBlockRef };
Expand Down

0 comments on commit a07718b

Please sign in to comment.