Conversation
Member
Author
|
To be clear: I think we need to keep the separation between |
WP_Theme_JSON_Resolver changes in both lib/compat/wordpress-6.0 and lib/experimental
Member
Author
|
Initially, I thought merging both resolvers was easier. But it also has cons: we no longer have the experimental changes in |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What?
This PR does two things:
lib/compat/6.0/wp-class-theme-json-resolver-6.0.phphas all the changes to be backported.lib/experimental/wp-class-theme-json-resolver-gutenberg.phphas all the changes to be backported and the experimental ones.Why?
By the process we have, we add changes to
lib/compat/6.0when they are supposed to land in WordPress 6.0 and we add them tolib/experimentalwhen they need more iteration and should not be backported. This is problematic when the same method contains both experimental changes and changes to be backported.This is the case of
WP_Theme_JSON_Resolver_*::get_theme_datamethod, that has changes to be backported and others that should not.How?
The
get_theme_datamethod in experimental is the one that will run, so it needs to have all the changes necessary to work well.On the other hand, we also need all those changes (but the experimental ones) in the
get_theme_datamethod oflib/compat/6.0, as to make sure they're backported. Though this method is not called.Alternatives:
lib/experimental, git history and understand what everything does. Every change to be backported for a method that needs experimental changes needs be ported at experimental._lib_experimental_changes_descriptionthat code atlib/experimentalcould use. We'll still need to mark the hook as not to port, so I thought why not doing it directly given it's a oneliner.lib/compatfor example) and mark the changes not to backport via comments, as in:Future
This PR tries to work with the model we have now to make sure everything is contained (we know what to backport) and it works (the experimental method has all the changes).
The existing approach has some pros:
lib/experimentalIt also has some cons
lib/experimentalandlib/compat/wordpress-6.0For now, given how close we're to the WordPress 6.0 cutoff, it seems easier to run with what we have. For the 6.1 cycle this may require further thinking and/or changing the approach to avoid changes not being backported.