Skip to content

Commit

Permalink
Gallery: Remove 'withNotices' HoC (#64384)
Browse files Browse the repository at this point in the history
* Gallery: Remove 'withNotices' HoC
* Relocate 'withViewportMatch' closer to its only usage

Co-authored-by: Mamaduka <[email protected]>
Co-authored-by: geriux <[email protected]>
Co-authored-by: youknowriad <[email protected]>
  • Loading branch information
4 people authored Aug 9, 2024
1 parent db35abd commit 00a965c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
9 changes: 1 addition & 8 deletions packages/block-library/src/gallery/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import clsx from 'clsx';
/**
* WordPress dependencies
*/
import { compose } from '@wordpress/compose';
import {
BaseControl,
PanelBody,
Expand All @@ -17,7 +16,6 @@ import {
MenuGroup,
MenuItem,
ToolbarDropdownMenu,
withNotices,
} from '@wordpress/components';
import {
store as blockEditorStore,
Expand All @@ -31,7 +29,6 @@ import {
import { Platform, useEffect, useMemo } from '@wordpress/element';
import { __, _x, sprintf } from '@wordpress/i18n';
import { useSelect, useDispatch } from '@wordpress/data';
import { withViewportMatch } from '@wordpress/viewport';
import { View } from '@wordpress/primitives';
import { createBlock } from '@wordpress/blocks';
import { createBlobURL } from '@wordpress/blob';
Expand Down Expand Up @@ -98,7 +95,7 @@ const MOBILE_CONTROL_PROPS_RANGE_CONTROL = Platform.isNative
const DEFAULT_BLOCK = { name: 'core/image' };
const EMPTY_ARRAY = [];

function GalleryEdit( props ) {
export default function GalleryEdit( props ) {
const {
setAttributes,
attributes,
Expand Down Expand Up @@ -696,7 +693,3 @@ function GalleryEdit( props ) {
</>
);
}
export default compose( [
withNotices,
withViewportMatch( { isNarrow: '< small' } ),
] )( GalleryEdit );
3 changes: 2 additions & 1 deletion packages/block-library/src/gallery/gallery.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { useState, useEffect } from '@wordpress/element';
import { mediaUploadSync } from '@wordpress/react-native-bridge';
import { WIDE_ALIGNMENTS } from '@wordpress/components';
import { useResizeObserver } from '@wordpress/compose';
import { withViewportMatch } from '@wordpress/viewport';

const TILE_SPACING = 8;

Expand Down Expand Up @@ -120,4 +121,4 @@ export const Gallery = ( props ) => {
);
};

export default Gallery;
export default withViewportMatch( { isNarrow: '< small' } )( Gallery );

1 comment on commit 00a965c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 00a965c.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/10318277918
📝 Reported issues:

Please sign in to comment.