Skip to content

Commit

Permalink
reverting back to old code because we're not getting the direct paren…
Browse files Browse the repository at this point in the history
…t, but the parent that matches a block name
  • Loading branch information
mogmarsh committed Sep 13, 2023
1 parent 0eb825e commit 0ed846e
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 0ed846e

Please sign in to comment.