Optimistically continue with empty data when user data for global styles is not a JSON#30088
Merged
Optimistically continue with empty data when user data for global styles is not a JSON#30088
Conversation
|
Size Change: +46 B (0%) Total Size: 1.41 MB
ℹ️ View Unchanged
|
Contributor
TestingRequirements
Browsers
Notes:
|
Contributor
|
+1 whenever questions are addressed |
Member
Author
|
If you take a look at the post_type of |
Member
Author
|
I've created #30133 to avoid creating revisions. |
jeyip
approved these changes
Mar 23, 2021
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.

We store user data in the database as a JSON. If, for any reason, the data is corrupted and no longer is in a JSON format, there's an error that prevent the front-end, and editors from loading.
This PR fixes that by logging the error but continuing assuming user data is empty, both in the server and client (site-editor).
How to test
trunkbranch and tt1-blocks theme, load the site editor and make some changes via the global styles sidebar (ex: set the background color to red). This makes sure there's a CPT holding user data in the database.post_name = wp-global-styles-tt1-blocks). Edit the contents of thepost_contentso it's not a JSON: for example, substitute them by the stringthis is not a json.Before this PR the front-end and editor will show an error and won't load.