-
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
Discontinue doing synchronous validation requests upon activating plugins #5101
Comments
This looks right to me. Side note: This will depend on the PR #5306 that I opened a few weeks ago because I think it will use the |
@jwold Yes, that's right. We may want to provide information about suppressing that plugin from AMP pages as well. I was able to reproduce the existing warning we have: Here's the current code that is responsible for that: amp-wp/includes/validation/class-amp-validation-manager.php Lines 211 to 220 in 5f42cde
amp-wp/includes/validation/class-amp-validation-manager.php Lines 1972 to 1993 in 5f42cde
amp-wp/includes/validation/class-amp-validation-manager.php Lines 2319 to 2374 in 5f42cde
|
@westonruter are you suggesting that we allow users to disable the offending plugin directly from the notice? That could work when a single plugin is throwing errors, but might get messy if multiple plugins are mentioned in the same notice. |
That's true. So we should probably just add a link to go to the Plugin Suppression section so the user can decide which plugins to suppress from there. |
From our meeting today: This is blocked by plugin compatibility scanning. When we have the endpoint for scanning, we can delete the server side PHP code. Right now when a user activates a plugin there's a loopback request server side, this slows activation fo the plugin. Can take 15-20 seconds to activate. This has been fixed in the post editor by making validation async. We can do the same here, upon activating a plugin we show an admin notice that's initially PHP rendered, "checking site for compatibility," then use JS to fetch the results and put them with an admin notice loading spinner and show the results. |
Hey @westonruter,
If the user selects to Activate the plugin, then:
I would love to know your thoughts on this, so do let me know. |
I don't think this will be feasible because the activation hook happens when activation happens and it doesn't provide an API to intercept activation. If you try to output something in the activation hook, WordPress core outputs this notice: If you try to In this case the plugin is not activated at all. In order to actually evaluate whether the plugin is causing any AMP/PX issues, the plugin has to be fully active so that we can do requests on the site to see its output. So instead of there being a notice to continue activation after errors are encountered, it needs to instead show a notice with a "Checking for plugin compatibility…" message which is then populated asynchronously after the site scan results are obtained. The info notice would change to a success status if no errors for the activated plugins are found, or else the status would change to a warning if there were issues encountered. In the case of encountered errors, the user could then have the option to suppress the plugin from running on AMP pages as you've depicted, but as we discussed earlier today we want to move away from suppression as being the first choice, especially when Standard mode is selected (which we want to default to in the future). Plugin suppression is really only a viable option when in a paired AMP scheme (Transitional mode or Reader mode). If we keep the plugin suppression CTA, it may make sense just as a link to the Plugin Suppression table on the settings screen. For technical users, the "view errors" link should probably be replaced with one or more links to Validated URL screens. If we only validate one URL after activating a plugin, then there could be just one link, but I'm thinking it will probably be best to do a full site scan (i.e. checking ~10 URLs) and then to debug the errors the user should be presented with links to each of the validated URL screens on which the activated plugin(s)' error(s) are present. |
Hey @westonruter Okay, I understood the flow that you've stated above and the errors that come along with it. So in this case we'll revert to the flow mentioned in the Implementation brief. For the remaining comments:
Yes, at present, for non-technical users it'll be a link to the plugin suppression section in the AMP settings screen. For this comment:
I do agree with the first statement, that we could show one link for the Validated URL. But for Multiple URLs i.e. site scan, showing each and every URL will not be feasible and could cause clutter. I do have an idea for this though. Do let me know if that's possible. If not, then would you recommend the link just directs to the list of Validated URLs? |
In the case of there being validation errors detected for the newly activated plugin(s), I think there should be (1) a link to the Plugin Suppression section, and (2) a list of links to Validated URLs on which the plugins' have errors occurring. The list of validated URLs could appear collapsed in a Then after that there can be the CTA to review the plugin suppression settings. Lastly, this would be another opportunity to mention the collection of AMP-compatible plugins. Once we have the ecosystem data integrated into the plugin directory (#4668), there could be a third CTA to "Consider alternative AMP-compatible plugins" that links to the tab in the Add Plugins screen that lists out AMP-compatible plugins. |
Okay, understood. Sending an Updated UI design for this. Once the ecosystem data is integrated into the plugin directory, then we could have this version of the design. Let me know your thoughts. |
Yeah, I think that's good.
The number will be variable, but figure on maybe up to 10. In any case, the list is collapsed by default so I don't think that's a problem. |
Adding a Figma link for reference and copy as well. https://www.figma.com/file/SfMlDvHc5KHxJmAZN12PIM/AMP-Design?node-id=2903%3A22353 |
Hi @westonruter, I have tested this item the validation work as expected if I activate a valid and invalid plugin: Some edge cases:
|
@fellyph That's correct. It will return results for all plugins, not just the one(s) activated. This was something that @delawski noted as well, but there's not a clean way to determine which plugin(s) have just been activated. And it's not entirely needed anyway.
@fellyph Are you saying that you have suppressed Elementor, after activating another plugin you still see validation errors coming from Elementor? I'm not seeing that. After I select “Suppressed” for Elementor in Plugin Suppression and Save: I can activate another plugin and I don't see Elementor listed anymore:
I think this has to do with certain sections growing in height after the initial scrolling has been done. I suggest opening a low-priority issue regarding that. |
QA Passed I will open, low priority issues for the small items |
Feature description
Depends on #4719.
Relates to #2069.
In #5100 no longer is a synchronous validation request performed when switching template modes. However, what remains is the synchronous validation request when activating plugins.
The validation errors are obtained in
AMP_Validation_Manager::validate_after_plugin_activation()
and then displayed viaAMP_Validation_Manager::print_plugin_notice()
.Instead, upon activating a plugin when the “Plugin activated” notice is displayed:
There should at that point also be an admin notice from the AMP plugin which is accompanied by an enqueued script which does an asynchronous request to check the site for validation issues. A spinner should be shown along with a message saying “checking for AMP compatibility issues”. Then once the results are back, a message can be shown saying there is no validation errors or that there are errors present with those activated plugins, and a link to see what they are.
As it is currently, this admin notice should probably be suppressed if the user doesn't have developer tools enabled.
There could also be a good tie-in here with Plugin Suppression to allow a user to easily deactivate the plugins on AMP responses.
Relates to wizard compatibility scanning in #4795 and #4719.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
Implementation brief
warning
class.success
class.QA testing instructions
Demo
Changelog entry
The text was updated successfully, but these errors were encountered: