Skip to content

Commit b0d8273

Browse files
authored
Merge pull request #53 from alleyinteractive/fix/get-query-parent
fix/get query parent
2 parents 0eb825e + 0ed846e commit b0d8273

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

blocks/post/edit.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import classnames from 'classnames';
22
import { InnerBlocks, useBlockProps } from '@wordpress/block-editor';
3-
import { PostPicker, useParentBlock } from '@alleyinteractive/block-editor-tools';
4-
import { dispatch, useSelect } from '@wordpress/data';
3+
import { PostPicker } from '@alleyinteractive/block-editor-tools';
4+
import { dispatch, select, useSelect } from '@wordpress/data';
55
import { __ } from '@wordpress/i18n';
66

77
import NoRender from './norender';
@@ -19,13 +19,6 @@ interface PostEditProps {
1919
isSelected: boolean;
2020
}
2121

22-
interface ParentBlock {
23-
attributes?: {
24-
posts: Array<number | null>;
25-
postTypes: string[];
26-
};
27-
}
28-
2922
/**
3023
* The wp-curate/post block edit function.
3124
*
@@ -41,7 +34,10 @@ export default function Edit({
4134
},
4235
isSelected,
4336
}: PostEditProps) {
44-
const queryParent: ParentBlock = useParentBlock(clientId) ?? {};
37+
// @ts-ignore
38+
const queryParentId = select('core/block-editor').getBlockParentsByBlockName(clientId, 'wp-curate/query')[0];
39+
// @ts-ignore
40+
const queryParent = select('core/block-editor').getBlock(queryParentId) ?? {};
4541
const {
4642
attributes: {
4743
posts = [],

0 commit comments

Comments
 (0)