Skip to content

Commit

Permalink
Add warning with invalid sources
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed Sep 3, 2024
1 parent 9d4f918 commit 798d4dd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/block-editor/src/hooks/block-bindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,20 @@ function BlockBindingsAttribute( { attribute, binding } ) {
const { source: sourceName, args } = binding || {};
const sourceProps =
unlock( blocksPrivateApis ).getBlockBindingsSource( sourceName );
const isUndefined = ! sourceProps;
return (
<VStack>
<Truncate>{ attribute }</Truncate>
{ !! binding && (
<Text
variant="muted"
variant={ ! isUndefined && 'muted' }
className="block-editor-bindings__item-explanation"
isDestructive={ isUndefined }
>
<Truncate>
{ args?.key || sourceProps?.label || sourceName }
{ ! sourceProps
? __( 'Invalid source' )
: args?.key || sourceProps?.label || sourceName }
</Truncate>
</Text>
) }
Expand Down

0 comments on commit 798d4dd

Please sign in to comment.