-
Notifications
You must be signed in to change notification settings - Fork 4.8k
ServerSideRender no longer passing post_id query arg #31786
Copy link
Copy link
Closed
Labels
[Package] Server Side Render/packages/server-side-render/packages/server-side-render[Type] RegressionRelated to a regression in the latest releaseRelated to a regression in the latest release
Description
Description
I believe the change in PR #29246 was slightly flawed.
It may have resolved the problem with Server Side Rendered blocks failing when used in the Site Editor or Template editor but it's broken other SSR blocks which depend on the post_id being passed on the REST request to render the block.
It was working in 10.3.2; broken in 10.4.0 and higher.
The code change was:
| if ( currentPostId && typeof currentPostId.id === 'number' ) { |
In my system typeof currentPostId.id is undefined.
I believe the code should have been
if ( currentPostId && typeof currentPostId === 'number' ) {
Step-by-step reproduction instructions
- Install a plugin such as sb-children-block, which is a plugin that relies on the
post_idbeing passed during server side rendering of the block in the editor. - With Gutenberg 10.3.2 demonstrate that for a page that has children the block works in both the editor and front end.
- Update to Gutenberg 10.4.0 or higher
- Retest. The block is not rendered correctly in the editor.
Expected behaviour
For <ServerSideRendered> blocks the post_id query arg should be passed to the server when editing a post.
Actual behaviour
It's not being passed. The blocks do not render correctly in the editor.
Screenshots or screen recording (optional)
Code snippet (optional)
WordPress information
- WordPress version: 5.7.1
- Gutenberg version: 10.6.0
- Are all plugins except Gutenberg deactivated? No
- Are you using a default theme (e.g. Twenty Twenty-One)? Yes
Device information
- Device: Desktop
- Operating system: Windows
- Browser: Chrome
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
[Package] Server Side Render/packages/server-side-render/packages/server-side-render[Type] RegressionRelated to a regression in the latest releaseRelated to a regression in the latest release
Type
Fields
Give feedbackNo fields configured for issues without a type.