-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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 server processing of wp-context
getting out of sync
#55436
Fix server processing of wp-context
getting out of sync
#55436
Conversation
This pull request has changed or added PHP files. Please confirm whether these changes need to be synced to WordPress Core, and therefore featured in the next release of WordPress. If so, it is recommended to create a new Trac ticket and submit a pull request to the WordPress Core Github repository soon after this pull request is merged. If you're unsure, you can always ask for help in the #core-editor channel in WordPress Slack. Thank you! ❤️ View changed files❔ lib/experimental/interactivity-api/class-wp-directive-context.php ❔ lib/experimental/interactivity-api/directives/wp-context.php ❔ phpunit/experimental/interactivity-api/directives/wp-context-test.php |
Flaky tests detected in f341fc1. 🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/6558724095
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code looks good to me. Approved!
PS: There's a thing that worries me: this is supposed to fail only when the content of wp-context
is not valid. Are we generating an invalid context somewhere, or could it be a different issue this time? 🤔
For now, let's cover invalid contexts. If more problems arise, we'll check them out 🙂 Thanks for the quick review, David! 🎉 |
👋 Hey! Checking if this PR should be included in 6.4 - if so, we should add the |
Hey @mikachan. No, this part is still experimental and it's not included in the 6.4 release. |
What?
Fix a problem where the internal stack of contexts could get out of sync when the JSON is not valid during the server processing of
wp-context
.Why?
As spotted by @DAreRodz here, the internal stack of contexts can get out of sync when a call to
set_context
fails.How?
Make sure that we're always adding a new
array
to the stack, even if the JSON is not valid.Testing Instructions
This is covered by a unit test, but if you want to test it out:
wp-context
directive.wp-context
and invalid JSONs.