Skip to content

Commit

Permalink
Inserter: Patterns: remove loading indicator (#67072)
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix authored and michalczaplinski committed Dec 5, 2024
1 parent 50ea357 commit 57c671c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
*/
import { useState } from '@wordpress/element';
import { useViewportMatch } from '@wordpress/compose';
import { Button, Spinner } from '@wordpress/components';
import { Button } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { useSelect } from '@wordpress/data';

/**
* Internal dependencies
Expand All @@ -16,8 +15,6 @@ import { PatternCategoryPreviews } from './pattern-category-previews';
import { usePatternCategories } from './use-pattern-categories';
import CategoryTabs from '../category-tabs';
import InserterNoResults from '../no-results';
import { store as blockEditorStore } from '../../../store';
import { unlock } from '../../../lock-unlock';

function BlockPatternsTab( {
onSelectCategory,
Expand All @@ -31,19 +28,6 @@ function BlockPatternsTab( {
const categories = usePatternCategories( rootClientId );

const isMobile = useViewportMatch( 'medium', '<' );
const isResolvingPatterns = useSelect(
( select ) =>
unlock( select( blockEditorStore ) ).isResolvingPatterns(),
[]
);

if ( isResolvingPatterns ) {
return (
<div className="block-editor-inserter__patterns-loading">
<Spinner />
</div>
);
}

if ( ! categories.length ) {
return <InserterNoResults />;
Expand Down
15 changes: 0 additions & 15 deletions packages/block-editor/src/store/private-selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,21 +406,6 @@ export const getAllPatterns = createRegistrySelector( ( select ) =>
}, getAllPatternsDependants( select ) )
);

export const isResolvingPatterns = createRegistrySelector( ( select ) =>
createSelector( ( state ) => {
const blockPatternsSelect = state.settings[ selectBlockPatternsKey ];
const reusableBlocksSelect = state.settings[ reusableBlocksSelectKey ];
return (
( blockPatternsSelect
? blockPatternsSelect( select ) === undefined
: false ) ||
( reusableBlocksSelect
? reusableBlocksSelect( select ) === undefined
: false )
);
}, getAllPatternsDependants( select ) )
);

const EMPTY_ARRAY = [];

export const getReusableBlocks = createRegistrySelector(
Expand Down

0 comments on commit 57c671c

Please sign in to comment.