Skip to content

Commit

Permalink
Add fallback for postId
Browse files Browse the repository at this point in the history
  • Loading branch information
SantosGuillamot committed May 29, 2024
1 parent 4011beb commit eb0ed70
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/editor/src/bindings/post-meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down

0 comments on commit eb0ed70

Please sign in to comment.