-
Notifications
You must be signed in to change notification settings - Fork 384
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
Refactoring and improving validation error handling #2285
Conversation
54149d1
to
dc4921d
Compare
dc4921d
to
f39fb77
Compare
IT IS A THING OF BEAUTY. |
I got a JS error when I:
|
Awesome, thanks a lot for testing! 🙂 😊 🎉 Looks like some variables haven't been properly exported. Probably happened sometime during an earlier webpack config rewrite. Should be an easy fix. That AMP Timeago block issue looks a bit more interesting. The error message doesn't seem to reveal much. |
Hmm, this might have to do with the way blocks are registered and then unregistered again when not using native AMP. I just tested this, and the timeago block was simply not visible at all (I expected a "this block is invalid" message). The crash only occurred once I tried switching to code editor. |
amp-editor-blocks needs to run after amp-block-editor
I just pushed e95bc41 which fixes the issue you have had with the JS error, by basically restoring the behavior from By the way, while doing this modernization I also fixed a few bugs with the existing code. For example, after filtering error types you no longer get an AYS dialog when navigating away from the page (since one did not make any changes). The filter: |
Yes it should. Can you please test again? |
According to Travis there is a test failure:
However, locally all the |
It passes for me locally as well. I'll debug that. |
@swissspidy ok, build fixed now. Feel free to merge when you're happy. |
Awesome, thanks a lot! There's one issue left that I have just noticed. Will need to shuffle some stuff around for that. |
The stories editor needs amp-editor-blocks, but not amp-block-editor
Inspector controls should be rendered before or after BlockEdit, not as a child of it
They should load _after_ the default ones
An attempt to reorganize the block validation and block editor scripts in order to further streamline the block editor integration.
Uses data stores to read and write necessary information, and then
withSelect
to ensure any validation errors are immediately shown without having to interact with the blocks.While restructuring the code for that I stumbled upon many parts that could be simplified or even completely removed because they were not actually used at all.
Demo: https://cloudup.com/c00a-dLj555
Fixes #2127.
Iterates on #1298.