Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions packages/block-library/src/post-template/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ export default function PostTemplateEdit( {
} = {},
templateSlug,
previewPostType,
postType: postTypeFromContext,
},
attributes: { layout },
__unstableLayoutClassNames,
Expand Down Expand Up @@ -187,10 +186,7 @@ export default function PostTemplateEdit( {
}
// When we preview Query Loop blocks we should prefer the current
// block's postType, which is passed through block context.
const usedPostType =
postTypeFromContext && postTypeFromContext !== 'page'
? postTypeFromContext
: previewPostType || postType;
const usedPostType = previewPostType || postType;
return {
posts: getEntityRecords( 'postType', usedPostType, {
...query,
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/query/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"default": false
}
},
"usesContext": [ "postType", "templateSlug" ],
"usesContext": [ "templateSlug" ],
"providesContext": {
"queryId": "queryId",
"query": "query",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,9 @@ import { useToolsPanelDropdownMenuProps } from '../../../utils/hooks';
const { BlockInfo } = unlock( blockEditorPrivateApis );

export default function QueryInspectorControls( props ) {
const {
attributes,
setQuery,
setDisplayLayout,
postTypeFromContext,
isSingular,
} = props;
const { attributes, setQuery, setDisplayLayout, isSingular } = props;
const { query, displayLayout } = attributes;
let {
const {
order,
orderBy,
author: authorIds,
Expand All @@ -67,16 +61,6 @@ export default function QueryInspectorControls( props ) {
parents,
format,
} = query;
// If a post type is set in context, update `postType` to match it,
// unless the post type is `page`, as it usually doesn't make sense to loop
// through pages.
if (
postTypeFromContext &&
postTypeFromContext !== 'page' &&
postTypeFromContext !== postType
) {
postType = postTypeFromContext;
}
const allowedControls = useAllowedControls( attributes );
const showSticky = postType === 'post';
const {
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/query/edit/query-content.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default function QueryContent( {
tagName: TagName = 'div',
query: { inherit } = {},
} = attributes;
const { templateSlug, postType } = context;
const { templateSlug } = context;
const { isSingular } = getQueryContextFromTemplate( templateSlug );
const { __unstableMarkNextChangeAsNotPersistent } =
useDispatch( blockEditorStore );
Expand Down Expand Up @@ -159,7 +159,6 @@ export default function QueryContent( {
setDisplayLayout={ updateDisplayLayout }
setAttributes={ setAttributes }
clientId={ clientId }
postTypeFromContext={ postType }
isSingular={ isSingular }
/>
</InspectorControls>
Expand Down