From ff9ffb7ba8e2212a343c1a76617d02d7ee669325 Mon Sep 17 00:00:00 2001 From: Mario Santos Date: Thu, 30 May 2024 10:44:57 +0200 Subject: [PATCH] Add fallback for postId --- packages/editor/src/bindings/post-meta.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/editor/src/bindings/post-meta.js b/packages/editor/src/bindings/post-meta.js index 8ed3295f56600b..03f4822ccebe5b 100644 --- a/packages/editor/src/bindings/post-meta.js +++ b/packages/editor/src/bindings/post-meta.js @@ -23,12 +23,14 @@ export default { ).meta?.[ args.key ]; }, setValue( { registry, context, args, value } ) { - const postType = context.postType - ? context.postType - : registry.select( editorStore ).getCurrentPostType(); + const postId = + context.postId || registry.select( editorStore ).getCurrentPostId(); + const postType = + context.postType || + registry.select( editorStore ).getCurrentPostType(); registry .dispatch( coreDataStore ) - .editEntityRecord( 'postType', postType, context.postId, { + .editEntityRecord( 'postType', postType, postId, { meta: { [ args.key ]: value, },