Skip to content

Commit

Permalink
Remove handling of default value in pattern overrides source `getValu…
Browse files Browse the repository at this point in the history
…e` function. Default should never be passed in to this function.
  • Loading branch information
talldan committed May 31, 2024
1 parent e5b834f commit 9b2dce8
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions packages/editor/src/bindings/pattern-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { _x } from '@wordpress/i18n';
import { store as blockEditorStore } from '@wordpress/block-editor';

const CONTENT = 'content';
const DEFAULT_ATTRIBUTES = '__default';

export default {
name: 'core/pattern-overrides',
Expand All @@ -20,16 +19,10 @@ export default {
true
);

const overriddenAttributes =
const overridableValue =
getBlockAttributes( patternClientId )?.[ CONTENT ]?.[
currentBlockAttributes?.metadata?.name
];
const overridableValue = overriddenAttributes?.[ attributeName ];
const defaultValue = overriddenAttributes?.[ DEFAULT_ATTRIBUTES ];

if ( defaultValue !== undefined ) {
return defaultValue;
}
]?.[ attributeName ];

// If there is no pattern client ID, or it is not overwritten, return the default value.
if ( ! patternClientId || overridableValue === undefined ) {
Expand Down

0 comments on commit 9b2dce8

Please sign in to comment.