-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
(WIP) Ignore deprecation messages for non-core-migrated preferences in the deprecation proxy #58145
Closed
fullofcaffeine
wants to merge
2
commits into
release/17.5
from
remove/non-core-migrated-preferences-from-deprecation-proxy
Closed
Changes from all commits
Commits
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
Oops, something went wrong.
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.
I don't really understand the change here. I was expecting just a removal of some keys from the array on line 7
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 updated the description, I'm experimenting with the following:
This basically has the same effect as removing the non-migrated preferences from the list, but it does it at runtime, ensuring the correct logic is selected for each of them just-in-time. I tried to get a list of non-migrated preferences, but the results were inconclusive. I used the following script that I ran from the browser console after the editor was loaded on the new post page:
For
release/17.5
, I got the following:At first sight, it seems I'd need to remove
editorMode
andhiddenBlockTypes
. But then, what aboutdistractionFree
,keepCareInsideBlock
andmostUsedBlocks
andfocusMode
? I suspect they are set in other code paths that have not run as part of the initial editor rendering.Another way would be to search the code for
get
orset
calls, but that's also error-prone.Finally, delegating the logic to the actual proxy at runtime seems safer, as it will be decided when the
get
is called instead of ahead of time. There might be a small performance hit compared to the other solution, but it'd be a good tradeoff, considering it's only specific torelease/17.5
.However, if you could clarify the cases above, we could remove them from the list as you originally suggested. Is it enough to remove
editorMode
andhiddenBlockTypes
from the list? What about the other ones (distractionFree
,keepCareInsideBlock
andmostUsedBlocks
andfocusMode
)?What do you think?
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.
undefined
value might meanfalse
so for me, it shouldn't be an indication about whether we should use one scope over the other.I don't really understand why we're complicating things:
The only difference with the trunk is the list of keys, in trunk all the keys are migrated.
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.
What am I missing?
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.
Right.
What would be the best way to find out what keys have/have not been migrated in
release/17.5
? Manually by checking the list of PRs in the branch? I wanted to avoid doing it manually as it could be error-prone (e.g I don't know what PRs were opened/merged related to this migration work).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.
Thanks for clarifying. Just to document here though,
undefined
was the return value that caused the BSOD in the Site Editor, which led me to work on this hotfix: #58031.Still, the logic here shouldn't break anything if the value returned from
core
isundefined
, as it will then fallback to the call in https://github.com/WordPress/gutenberg/pull/58145/files#diff-d90eaf55b416dc18bd23b193564ae65f7555ab87a40c0ceae54137374c6ca510R4 which should then returnundefined
if the setting is not in the given scope, or an actual truthy value if it is.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.
It looks like the non-migrated keys in
release/17.5
areeditorMode
andhiddenBlockTypes
, see my comment in #. I don't know about the others (distractionFree
,keepCareInsideBlock
,mostUsedBlocks
andfocusMode
) that are not found anywhere else (core
,core/edit-post
,core/edit-site
), though.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'll open another PR with those two settings removed from the list. I will keep this draft, just in case. I'll use the test results to see if there are remaining preferences that should be removed from the list.
EDIT: #58153.