Skip to content

Commit

Permalink
Merge pull request #53 from alleyinteractive/fix/get-query-parent
Browse files Browse the repository at this point in the history
fix/get query parent
  • Loading branch information
mogmarsh authored Sep 13, 2023
2 parents 0eb825e + 0ed846e commit b0d8273
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions blocks/post/edit.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import classnames from 'classnames';
import { InnerBlocks, useBlockProps } from '@wordpress/block-editor';
import { PostPicker, useParentBlock } from '@alleyinteractive/block-editor-tools';
import { dispatch, useSelect } from '@wordpress/data';
import { PostPicker } from '@alleyinteractive/block-editor-tools';
import { dispatch, select, useSelect } from '@wordpress/data';
import { __ } from '@wordpress/i18n';

import NoRender from './norender';
Expand All @@ -19,13 +19,6 @@ interface PostEditProps {
isSelected: boolean;
}

interface ParentBlock {
attributes?: {
posts: Array<number | null>;
postTypes: string[];
};
}

/**
* The wp-curate/post block edit function.
*
Expand All @@ -41,7 +34,10 @@ export default function Edit({
},
isSelected,
}: PostEditProps) {
const queryParent: ParentBlock = useParentBlock(clientId) ?? {};
// @ts-ignore
const queryParentId = select('core/block-editor').getBlockParentsByBlockName(clientId, 'wp-curate/query')[0];
// @ts-ignore
const queryParent = select('core/block-editor').getBlock(queryParentId) ?? {};
const {
attributes: {
posts = [],
Expand Down

0 comments on commit b0d8273

Please sign in to comment.