Skip to content

Commit

Permalink
Merge useSelect calls
Browse files Browse the repository at this point in the history
  • Loading branch information
artemiomorales committed May 16, 2024
1 parent 39c43f5 commit 3771101
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/block-editor/src/hooks/block-bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ import { unlock } from '../lock-unlock';
import InspectorControls from '../components/inspector-controls';

export const BlockBindingsPanel = () => {
const { bindings } = useSelect( ( select ) => {
const { bindings, sources } = useSelect( ( select ) => {
const { getSelectedBlockClientId, getBlock } =
select( blockEditorStore );
const _selectedBlockClientId = getSelectedBlockClientId();
const _sources = unlock(
select( blocksStore )
).getAllBlockBindingsSources();

return {
bindings: getBlock( _selectedBlockClientId ).attributes?.metadata
?.bindings,
sources: _sources,
};
}, [] );

const sources = useSelect( ( select ) =>
unlock( select( blocksStore ) ).getAllBlockBindingsSources()
);

if ( ! bindings ) {
return null;
}
Expand Down

0 comments on commit 3771101

Please sign in to comment.