-
Notifications
You must be signed in to change notification settings - Fork 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
Disregard template validity in the context of FSE #35041
Conversation
This is VERY much a hack around WordPress/gutenberg#11681 Previously, it was fine to do this just once at the beginning. But we discovered that it also happens when performing undo. Granted, performing undo might do something else, but my best guess is that it's related to the above issue.
@@ -19,7 +19,5 @@ const unsubscribe = subscribe( () => { | |||
} | |||
if ( select( 'core/editor' ).isValidTemplate() === false ) { | |||
dispatch( 'core/editor' ).setTemplateValidity( true ); | |||
// should only need to do this once |
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.
RIP :)
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
Confirmed this fixes the notice when performing an undo. Could we use this hack for now and contribute a better fix back to core Gutenberg via that issue? |
I think this is fine since the Fix action that is shown to user in this case isn't correcting it. If they can't fix it, there isn't much value in showing the notice when there are no other noticeable defects. |
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.
Works as described!
I don't have better ideas atm, except for fixing it in core.
That's a great point. Definitely improves the UX since the notice would really only be helpful to us if it was telling the truth. |
This is VERY much a hack around WordPress/gutenberg#11681
Previously, it worked to just hack this once at the beginning. But the error message is also popping up when performing undo in Gutenberg. I admit it's possible that something different could be happening in this case. But I haven't been able to come up with a reason why - my best guess is that it also triggers the same template validity issues that we had to hack when the editor loads. I realize this is not a great patch, so I'm open to other suggestions. Note that we won't be able to ditch this check entirely because of the core gutenberg issue.
The downsides of this approach: we never get warned if the template is invalid for good reasons. However, I've tried to get something to break in the editor after the template validity goes wrong after performing undo, but everything works as expected. So I don't really think that anything is going wrong under the hood.
Changes proposed in this Pull Request
Testing instructions
Fixes #34831
cc @mmtr who originally authored this hack to only happen once.