Skip to content
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

Fix response for home template in /pages for Coming Soon sites #71541

Merged
merged 1 commit into from
Jan 5, 2023

Conversation

candy02058912
Copy link
Contributor

@candy02058912 candy02058912 commented Dec 28, 2022

Proposed Changes

  • template_redirect returns a HTML response instead of a JSON response expected here
  • This results in null response for https://public-api.wordpress.com/wpcom/v2/sites/:blog_id/block-editor?_envelope=1
    (notice the null values in home_template), which then prevents the Homepage template from being rendered (screenshots below)
{
	"body": {
		"is_fse_eligible": true,
		"is_fse_active": false,
		"home_template": {
			"postType": null,
			"postId": null
		}
	},
	"status": 200,
	"headers": {
		"Allow": "GET"
	}
}
Before After

Testing Instructions

This is a fix for atomic sites in "Coming Soon" mode.

  • Checkout to this branch
  • Follow the steps here (PCYsg-ly5-p2) for testing editing-toolkit changes on atomic sites
  • Go to /pages/:site to see if it renders the homepage
  • Alternatively: check the API response for https://public-api.wordpress.com/wpcom/v2/sites/:blog_id/block-editor?_envelope=1
{
	"body": {
		"is_fse_eligible": true,
		"is_fse_active": false,
		"home_template": {
			"postType": "wp_template",
			"postId": "quadrat-white\/\/index" // the fse-supported theme you chose
		}
	},
	"status": 200,
	"headers": {
		"Allow": "GET"
	}
}

Feel free to test around the issue to see if private atomic/simple sites are functioning correctly.

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-ajp-p2)?

Fixes #71375

@candy02058912 candy02058912 requested a review from a team December 28, 2022 10:02
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Dec 28, 2022
@github-actions
Copy link

github-actions bot commented Dec 28, 2022

@matticbot
Copy link
Contributor

This PR modifies the release build for editing-toolkit

To test your changes on WordPress.com, run install-plugin.sh editing-toolkit fix/private-site-home-template on your sandbox.

To deploy your changes after merging, see the documentation: PCYsg-mMA-p2

@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

Copy link
Contributor

@bangank36 bangank36 left a comment

Choose a reason for hiding this comment

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

LGTM

@arthur791004
Copy link
Contributor

Looks like this way doesn't work when the Privacy of the atomic site is set to "Private" 😔

@candy02058912 candy02058912 changed the title Fix response for home template in /pages for private sites Fix response for home template in /pages for Coming Soon sites Jan 5, 2023
@candy02058912 candy02058912 merged commit 6beed08 into trunk Jan 5, 2023
@candy02058912 candy02058912 deleted the fix/private-site-home-template branch January 5, 2023 10:04
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 5, 2023
samiff added a commit to Automattic/jetpack that referenced this pull request Feb 10, 2023
samiff added a commit to Automattic/jetpack that referenced this pull request Feb 10, 2023
matticbot pushed a commit to Automattic/jetpack-mu-wpcom that referenced this pull request Feb 10, 2023
matticbot pushed a commit to Automattic/jetpack-mu-wpcom-plugin that referenced this pull request Feb 10, 2023
matticbot pushed a commit to Automattic/jetpack-storybook that referenced this pull request Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants