-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Patterns: Don't inject theme attr on frontend #5455
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
Closed
ockham
wants to merge
10
commits into
WordPress:trunk
from
ockham:try/fixing-theme-attr-injection-perf-regression
Closed
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
909ec6b
Patterns: Don't inject theme attr on frontend
ockham 8fb2f79
Remove _inject_theme_attribute_in_template_part_block() and all its u…
felixarntz 9751e1c
Revert "Remove _inject_theme_attribute_in_template_part_block() and a…
felixarntz 9315aa3
Only call _inject_theme_attribute_in_template_part_block() if a REST …
felixarntz 5932fba
Only call _inject_theme_attribute_in_template_part_block() if a REST …
felixarntz 5c27373
Avoid duplicate code.
felixarntz 44d7eab
Remove tests which are no longer applicable.
felixarntz 14f6306
Implement test coverage to ensure template part block works correctly…
felixarntz 2af8248
Use `!== null` equality checks
ockham 17ca37a
Use `!== null` equality checks once more
ockham 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
Only call _inject_theme_attribute_in_template_part_block() if a REST …
…API request.
- Loading branch information
commit 9315aa3e9eb26f5a504ad9deba6f9c40848c7420
There are no files selected for viewing
This file contains hidden or 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 hidden or 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.
We might consider moving the code that injects the
themeattr to the patterns controller instead. Probably okay to leave as-is for now, but might be a nice follow-up post-6.4.(Noting that if we still insert hooked blocks here, we'd be running
traverse_and_serialize_blockstwice, which is suboptimal; so we'd also need to move hooked blocks insertion to the controller so we can remove it here; which would then require us to make sure it's run on the frontend. We can probably achieve that through running it in the Pattern block'srender_block. This means that we'd need to make quite a few changes, which we most likely don't want to do before 6.4.)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.
Can you explain why
traverse_and_serialize_blockswould get called twice?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.
Assuming that we inject the
themeattr in the patterns controller, but keep hooked blocks insertion here in the patterns registry (since it's needed both for the frontend and editor (i.e. REST API)) -- both of these calltraverse_and_serialize_blocks😅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.
I see what you mean here - If we were to run the
themeattribute injection in the REST API controller. Yes, good point that it would get called twice with different processing 👍🏻