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

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

Merged
merged 1 commit into from
Feb 15, 2024

Conversation

cbravobernal
Copy link
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 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta [Block] Search Affects the Search Block - used to display a search field labels Feb 14, 2024
Copy link

github-actions bot commented Feb 14, 2024

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 <[email protected]>
Co-authored-by: gziolo <[email protected]>

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

Copy link

github-actions bot commented Feb 14, 2024

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
Copy link
Member

gziolo commented Feb 15, 2024

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

Copy link
Member

@gziolo gziolo left a comment

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
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
65 checks passed
@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
Copy link
Member

gziolo commented Feb 15, 2024

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
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
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 <[email protected]>
Co-authored-by: gziolo <[email protected]>
@getdave
Copy link
Contributor

getdave commented Feb 20, 2024

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

@getdave getdave removed the Backport to WP 6.7 Beta/RC Pull request that needs to be backported to the WordPress major release that's currently in beta label Feb 20, 2024
youknowriad pushed a commit that referenced this pull request Feb 20, 2024
Co-authored-by: c4rl0sbr4v0 <[email protected]>
Co-authored-by: gziolo <[email protected]>
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