-
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
Handle case in Site Scanning when no scannable URL is available #6856
Conversation
In the Reader mode, only post types are used for performing a site scan. If there are no posts, pages or other custom post types available for a scan, a request made to the `/wp-json/amp/v1/scannable-urls` endpoint returns an empty array. With this change, an empty array is treated as a valid response so that the list of scannable URLs kept in the Site Scan state is emptied. This case is then handled gracefully on the frontend where an error message is rendered. The message says that there are no URLs available for a scan. Even though the error message has already been part of the Site Scan UI, it was displayed only if there were no scannable URLs available initially, right after a page load.
Plugin builds for 1dec195 are ready 🛎️!
|
Codecov Report
@@ Coverage Diff @@
## develop #6856 +/- ##
=============================================
- Coverage 78.36% 77.55% -0.82%
Complexity 6721 6721
=============================================
Files 202 267 +65
Lines 20276 21460 +1184
=============================================
+ Hits 15890 16644 +754
- Misses 4386 4816 +430
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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.
Behavior checks out. I registered a Recipe custom post type that had no posts created for it.
Before
Before once I updated the supported post types to only have Recipes, the Site Scan allowed by to initiate a scan but then it failed:
before.mov
After
After the fix, as soon as I saved the settings it immediately showed the appropriate error message up front:
after.mov
@westonruter For the scenario where few of the post type have post and few doesn't. What will happen in that case. Will site scan continue or throws error. |
@yogeshbeniwal As long as one of the post types have an AMP URL available, the site scan should proceed as expected. @fellyph Would you confirm? |
Yes, only the post type with one or more posts will be part of the scan. This fix was for users who select a post type with no posts. |
Thank you @westonruter @fellyph for confirmation. |
Summary
Fixes #6855
In the Reader mode, only post types are used for performing a site scan. If there are no posts, pages or other custom post types available for a scan, a request made to the
/wp-json/amp/v1/scannable-urls
endpoint returns an empty array.With this change, an empty array is treated as a valid response so that the list of scannable URLs kept in the Site Scan state is emptied. This case is then handled gracefully on the frontend where an error message is rendered. The message says that there are no URLs available for a scan.
Even though the error message has already been part of the Site Scan UI, it was displayed only if there were no scannable URLs available initially, right after a page load.
Checklist