-
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
Code improvements for the SSR part of the Interactivity API #51640
Merged
DAreRodz
merged 18 commits into
interactivity
from
interactivity-api-ssr-code-improvements
Jun 23, 2023
Merged
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f3cac84
Fix multi-line comments and add examples
DAreRodz 250e7b1
Add parse_attribute_name static method to WP_Directive_Processor
DAreRodz bd8e120
Replace array functions with a foreach loop
DAreRodz 92a2b6f
Add explanatory comment for the negation operator check
DAreRodz f3a59a2
Replace $array with $path_segments
DAreRodz 7e02740
Minor fix for the negation operator comment
DAreRodz 8a1795e
Call only instances of Closure
DAreRodz 0f4c0f7
Improve negation operator code style
DAreRodz 29619eb
Do not lower-case tags
DAreRodz 5c651e1
Use static parse_attribute_name inside directive processors
DAreRodz fc7ab88
Add basic error handling in wp-context
DAreRodz 10abf30
Fix hidden identation errors
DAreRodz 364e073
Use the correct variable name
DAreRodz b0252c3
Fix test for evaluating functions
DAreRodz 63fe0ff
Remove references to "attribute" directives
DAreRodz ae67933
Remove emtpy lines in multi-line function calls
DAreRodz 06620e9
Fix typo
DAreRodz 9e28311
Merge branch 'interactivity' into interactivity-api-ssr-code-improvem…
luisherranz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,10 @@ function gutenberg_interactivity_process_wp_context( $tags, $context ) { | |
} | ||
|
||
$new_context = json_decode( $value, true ); | ||
// TODO: Error handling. | ||
if ( null === $new_context ) { | ||
// Invalid JSON defined in the directive. | ||
return; | ||
} | ||
Comment on lines
-27
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the future, this type of error handling should be centralized in the Actually, it's pretty basic, but there is already protection against falsy values like |
||
|
||
$context->set_context( $new_context ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
tiny nitpick: "ignored
inon purpose"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.
Fixed. ✅ Thanks for the review, Dennis. 😄