fix: guard CHRNX editorial state

This commit is contained in:
chrnx committed 2026-08-11 14:44:31 -05:00
1 parent e031b753cd
commit a5b94123a8
8 files changed
+285 -19

No files matched your search

+17 -2
View File
@@ -54,15 +54,30 @@
}
const editor = wp.data.select( 'core/editor' );
if ( ! editor || editor.getCurrentPostType() !== 'post' ) {
if (
! editor ||
typeof editor.getCurrentPostType !== 'function' ||
typeof editor.getEditedPostAttribute !== 'function' ||
editor.getCurrentPostType() !== 'post'
) {
return false;
}
function PodcastPanel() {
const editorState = wp.data.useSelect( function ( select ) {
if ( typeof select !== 'function' ) {
return null;
}
const currentEditor = select( 'core/editor' );
const core = select( 'core' );
if ( ! currentEditor || ! core || typeof core.getEntityRecord !== 'function' ) {
if (
! currentEditor ||
typeof currentEditor.getCurrentPostType !== 'function' ||
typeof currentEditor.getEditedPostAttribute !== 'function' ||
! core ||
typeof core.getEntityRecord !== 'function'
) {
return null;
}