Skip to content

Interactivity API: Fix server side rendering for Search block#59029

Merged
cbravobernal merged 1 commit into
trunkfrom
fix/search-block-not-being-ssred
Feb 15, 2024
Merged

Interactivity API: Fix server side rendering for Search block#59029
cbravobernal merged 1 commit into
trunkfrom
fix/search-block-not-being-ssred

Conversation

@cbravobernal

Copy link
Copy Markdown
Contributor

What?

#58943 introduced a reversion on the search block, SSR is not working in Search block due to a escaping commas issue.
Screenshot 2024-02-14 at 19 15 52

Testing Instructions

  • Insert search block, only button, with text instead of an icon.
  • Check that in trunk you have a movement on the input.
  • Check that in this PR that movement does not happen.

Testing Instructions for Keyboard

Screenshots or screencast

Before:

before.mov

After:

after.mov

@cbravobernal cbravobernal added [Type] Bug An existing feature does not function as intended Backport to WP Beta/RC [Block] Search Affects the Search Block - used to display a search field labels Feb 14, 2024
@github-actions

github-actions Bot commented Feb 14, 2024

Copy link
Copy Markdown

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: c4rl0sbr4v0 <cbravobernal@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>

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

@github-actions

github-actions Bot commented Feb 14, 2024

Copy link
Copy Markdown

Flaky tests detected in 95e1a79.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7905654479
📝 Reported issues:

@gziolo

gziolo commented Feb 15, 2024

Copy link
Copy Markdown
Member

What could help to catch this type of issue with server-side rendering in the future?

@gziolo gziolo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Code change makes perfect sense. I haven't tested it.

@cbravobernal

Copy link
Copy Markdown
Contributor Author

What could help to catch this type of issue with server-side rendering in the future?

It is hard to test the sync between the server side and the client side. I cannot think anything rather than snapshots testing.

@cbravobernal cbravobernal merged commit c32dd34 into trunk Feb 15, 2024
@cbravobernal cbravobernal deleted the fix/search-block-not-being-ssred branch February 15, 2024 11:43
@github-actions github-actions Bot added this to the Gutenberg 17.8 milestone Feb 15, 2024
@gziolo

gziolo commented Feb 15, 2024

Copy link
Copy Markdown
Member

It is hard to test the sync between the server side and the client side. I cannot think anything rather than snapshots testing.

So you would have to compare Preact's HTML output with WP's HTML output for the same chunk rendered?

@cbravobernal

Copy link
Copy Markdown
Contributor Author

So you would have to compare Preact's HTML output with WP's HTML output for the same chunk rendered?

That would be the ideal, but maybe is easier, for core blocks, just to save a snapshot of the server render and compare if somebody changes the render_callback

@DAreRodz

Copy link
Copy Markdown
Contributor

Just a note here. This case is interesting. I would have expected data-wp-interactive='"core/search"' to work because it is a valid JSON and is parsed into the core/search string (see vdom.ts#L84).

value = JSON.parse( '"core/search"' );
value === 'core/search' // true

getdave pushed a commit that referenced this pull request Feb 20, 2024
Co-authored-by: c4rl0sbr4v0 <cbravobernal@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>
@getdave

getdave commented Feb 20, 2024

Copy link
Copy Markdown
Contributor

I just cherry-picked this PR to the cherry-pick-beta-2 branch to get it included in the next release: 4d94d57

youknowriad pushed a commit that referenced this pull request Feb 20, 2024
Co-authored-by: c4rl0sbr4v0 <cbravobernal@git.wordpress.org>
Co-authored-by: gziolo <gziolo@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Search Affects the Search Block - used to display a search field [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants