Skip to content

Core data: getHomePage: do not return object until resolved #70345

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2025

Conversation

ellatrix
Copy link
Member

@ellatrix ellatrix commented Jun 6, 2025

What?

Closes

getHomePage currently returns an object ({ postType: 'wp_template', postId: null }) while getDefaultTemplateId is still resolving. It should return null instead until it's fully resolved.

Why?

We can't do much with partially resolved data. In fact, can do harm because for a user without the necessary caps, it will return the same object, which makes it impossible to differentiate between loading state and a user without privileges.

How?

Return null until getDefaultTemplateId returns an ID.

Testing Instructions

For a site without a front-page set, load the root of the site editor. It should still work.

Testing Instructions for Keyboard

Screenshots or screencast

Before After

@ellatrix ellatrix requested a review from nerrad as a code owner June 6, 2025 08:02
@ellatrix ellatrix added [Type] Bug An existing feature does not function as intended [Package] Core data /packages/core-data labels Jun 6, 2025
Copy link

github-actions bot commented Jun 6, 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: ellatrix <ellatrix@git.wordpress.org>
Co-authored-by: mcsf <mcsf@git.wordpress.org>

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

@ellatrix ellatrix merged commit ce2dd7d into trunk Jun 6, 2025
67 checks passed
@ellatrix ellatrix deleted the fix/get-home-page branch June 6, 2025 09:14
@github-actions github-actions bot added this to the Gutenberg 21.1 milestone Jun 6, 2025
chriszarate pushed a commit to chriszarate/gutenberg that referenced this pull request Jul 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Core data /packages/core-data [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants