Skip to content

Commit

Permalink
Query Loop: Fix 'block' scoped variations to get the query defaults (
Browse files Browse the repository at this point in the history
…WordPress#63477)

Co-authored-by: ntsekouras <ntsekouras@git.wordpress.org>
Co-authored-by: youknowriad <youknowriad@git.wordpress.org>
  • Loading branch information
3 people authored and carstingaxion committed Jul 18, 2024
1 parent c3a6a94 commit 07b286e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 21 deletions.
22 changes: 1 addition & 21 deletions packages/block-library/src/query/edit/query-placeholder.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ export default function QueryPlaceholder( {
clientId,
name,
openPatternSelectionModal,
setAttributes,
} ) {
const [ isStartingBlank, setIsStartingBlank ] = useState( false );
const blockProps = useBlockProps();
Expand Down Expand Up @@ -64,7 +63,6 @@ export default function QueryPlaceholder( {
<QueryVariationPicker
clientId={ clientId }
attributes={ attributes }
setAttributes={ setAttributes }
icon={ icon }
label={ label }
/>
Expand Down Expand Up @@ -101,13 +99,7 @@ export default function QueryPlaceholder( {
);
}

function QueryVariationPicker( {
clientId,
attributes,
setAttributes,
icon,
label,
} ) {
function QueryVariationPicker( { clientId, attributes, icon, label } ) {
const scopeVariations = useScopedBlockVariations( attributes );
const { replaceInnerBlocks } = useDispatch( blockEditorStore );
const blockProps = useBlockProps();
Expand All @@ -118,18 +110,6 @@ function QueryVariationPicker( {
label={ label }
variations={ scopeVariations }
onSelect={ ( variation ) => {
if ( variation.attributes ) {
setAttributes( {
...variation.attributes,
query: {
...variation.attributes.query,
postType:
attributes.query.postType ||
variation.attributes.query.postType,
},
namespace: attributes.namespace,
} );
}
if ( variation.innerBlocks ) {
replaceInnerBlocks(
clientId,
Expand Down
3 changes: 3 additions & 0 deletions test/e2e/specs/editor/various/is-typing.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ test.describe( 'isTyping', () => {
.getByRole( 'button', { name: 'Title & Date' } )
.click();

await editor.openDocumentSettingsSidebar();
await page.getByLabel( 'Inherit query from template' ).click();

// Moving the mouse shows the toolbar.
await editor.showBlockToolbar();
// Open the dropdown.
Expand Down

0 comments on commit 07b286e

Please sign in to comment.