Skip to content

Conversation

@kmanijak
Copy link
Contributor

What?

Closes

Updating select( 'core/editor' ).getCurrentPostId() return types.

Why?

Type of select( 'core/editor' ).getCurrentPostId() is incorrect as it may return string or number not only number.

How?

Testing Instructions

  1. Create new post
  2. In console browser run select( 'core/editor' ).getCurrentPostId() -> number
  3. Go to Editor > Templates > some template
  4. In console browser run select( 'core/editor' ).getCurrentPostId() -> string
Post Editor Site Editor
image image

Testing Instructions for Keyboard

Screenshots or screencast

Before After

@github-actions
Copy link

github-actions bot commented Aug 26, 2025

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: kmanijak <karolmanijak@git.wordpress.org>
Co-authored-by: im3dabasia <im3dabasia1@git.wordpress.org>
Co-authored-by: Mamaduka <mamaduka@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@im3dabasia im3dabasia added [Type] Code Quality Issues or PRs that relate to code quality [Package] Editor /packages/editor labels Aug 26, 2025
Copy link
Contributor

@im3dabasia im3dabasia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this PR. The change looks good 🚀

* @param {Object} state Global application state.
*
* @return {?number} ID of current post.
* @return {?(string|number)} Template slug or current post ID.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* @return {?(string|number)} Template slug or current post ID.
* @return {?(string|number)} The current post ID or template slug.

Let's emphasize the post ID.

Copy link
Contributor Author

@kmanijak kmanijak Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Updated in 7d658bb. I swapped types as well so there's more logical order.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @kmanijak!

@kmanijak kmanijak requested a review from Mamaduka August 27, 2025 12:30
Copy link
Member

@Mamaduka Mamaduka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to merge ✅

@Mamaduka Mamaduka merged commit 06ce64d into WordPress:trunk Aug 27, 2025
72 of 73 checks passed
@github-actions github-actions bot added this to the Gutenberg 21.6 milestone Aug 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Package] Editor /packages/editor [Type] Code Quality Issues or PRs that relate to code quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants