feat(aio): add prettier network fail page#16139
feat(aio): add prettier network fail page#16139wardbell wants to merge 6 commits intoangular:masterfrom
Conversation
5d8879e to
71fa91d
Compare
|
The angular.io preview for daa7d40910fcd57ff0c53b28765ff0c289c5b669 is available here. |
|
The angular.io preview for 739d3188567261115810ba7cddf79f7678891751 is available here. |
|
The angular.io preview for 5d8879e696ed706f5c5d33b328b7b5c78bf8bd27 is available here. |
|
The angular.io preview for 71fa91d5610a517c4ddad913e4c473ac94d22c47 is available here. |
gkalpak
left a comment
There was a problem hiding this comment.
LGTM 👍
Not related to this PR, but I wish we would use consistent names for variables 😛
There was a problem hiding this comment.
Only adding to the cache after the document arrives means that multiple hits to this URL will cause multiple requests until one of them responds.
We should add the observable to the cache when the request is made but then remove it from the cache if the doc that is returned should not be cached.
There was a problem hiding this comment.
Something like:
this.cache.set(path, this.fetchDocument(path).do(doc => {
if (doc.nocache) { this.cache.remove(path); }
});
aio/src/index.html
Outdated
There was a problem hiding this comment.
what does async attribute do here? images are loaded in an asynchronous fashion by default.
There was a problem hiding this comment.
comma missing before "but"?
There was a problem hiding this comment.
This text is confusing. How about something shorter and more to the point like: We are sorry, but due to a network issue we can't load document "{{doc}}". Please check your connection and try again.
There was a problem hiding this comment.
Because the error isn't always a network issue. It arises from bad JSON, server down (which is not a network connection), and who knows what else.
The rules for commas and conjunctions, especially "but", are all over the place. Some say add it. Some say never! My research and experience say "no comma" in this place but reasonable minds may differ (no comma in that one :)).
Better is to drop the apology.
There was a problem hiding this comment.
We can drop the icon altogether too. I just added one because the 404 page had one.
There was a problem hiding this comment.
What's the purpose of "error_outline" text in here? I've seen you use this kind of text elsewhere and it's this text that is causing the flicker. Please remove.
There was a problem hiding this comment.
I'm using them exactly as prescribed by the Material Design Guidelines, e.g.,
<i class="material-icons">face</i>
In this case, flicker is highly improbably because there is almost no way to get to this page before the font loads. Therefore, I'm keeping it.
But we need a broader strategy for using MD icons. That should be a separate issue.
There was a problem hiding this comment.
Interesting, I didn't know that MD fonts were using ligatures. In that case we must ensure that the font is loaded before we render anything that depends on it.
There was a problem hiding this comment.
why is this page implemented differently than the file not found page? you could implement in the same way as 404 and then use service worker and/or <link rel="preload" to cache it. (https://css-tricks.com/prefetching-preloading-prebrowsing/)
There was a problem hiding this comment.
Reasons:
-
This is the ultimate error fallback. It should never fail. This approach is guaranteed to work even when there is no network (assuming that you've loaded the JS of course).
-
Service worker is not enabled on most devices.
-
MDN is not clear on browser support for
prefetch.
Why worry? If we're going to get it anyway, and we inline templates routinely, what's wrong with doing it here? Seems simple and sure to me.
|
Take a look at |
|
Updates address the critical objections raised by reviewers. Stef and I will work on the remaining cosmetic issues in a separate PR. @petebacondarwin Please note that the entry in the cache for a document that 404s now has the |
71fa91d to
acbd486
Compare
No! 😱 That was the whole point of my change previously! We need to be able to assign the |
acbd486 to
23b57aa
Compare
|
The angular.io preview for 23b57aa35faf217d449b11b3deb5bca02160c59c is available here. |
I made changes to this so my review is no longer valid :-)
wardbell
left a comment
There was a problem hiding this comment.
Looks great, Pete. Ship it!
This enables things like embedded components easy access to a clean version of the current location path.
) Dgeni is now providing the `id` for all the documents to be viewed. So we no longer need to add this to the DocumentContents object. There are some notable changes in the refactoring: `DocumentService`: * The id of the document to render is now obtained from `LocationService.path()`. * The `getFileNotFoundDoc` and `getErrorDoc` methods have been extracted from the `fetchDocument` method. `AppComponent`: * the `pageId` is now computed in a separate `setPageId` method. `AppComponen` spec file: * The `TestHttp` has had the hard coded documents removed and replaced with a function that will generate docs as needed.
|
closed with 9730351 |
This enables things like embedded components easy access to a clean version of the current location path.
…ular#16139) Dgeni is now providing the `id` for all the documents to be viewed. So we no longer need to add this to the DocumentContents object. There are some notable changes in the refactoring: `DocumentService`: * The id of the document to render is now obtained from `LocationService.path()`. * The `getFileNotFoundDoc` and `getErrorDoc` methods have been extracted from the `fetchDocument` method. `AppComponent`: * the `pageId` is now computed in a separate `setPageId` method. `AppComponen` spec file: * The `TestHttp` has had the hard coded documents removed and replaced with a function that will generate docs as needed.
This enables things like embedded components easy access to a clean version of the current location path.
…ular#16139) Dgeni is now providing the `id` for all the documents to be viewed. So we no longer need to add this to the DocumentContents object. There are some notable changes in the refactoring: `DocumentService`: * The id of the document to render is now obtained from `LocationService.path()`. * The `getFileNotFoundDoc` and `getErrorDoc` methods have been extracted from the `fetchDocument` method. `AppComponent`: * the `pageId` is now computed in a separate `setPageId` method. `AppComponen` spec file: * The `TestHttp` has had the hard coded documents removed and replaced with a function that will generate docs as needed.
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |

closes #16112.
When server or network goes down, we serve a canned page. Current ugly page is described in issue #16112.
This PR provides a prettier page along the lines of the better looking 404 page.
It does NOT cache the page so that, once connectivity is restored, it will try again to get that page.
I found a free “network crashed” svg that’s tiny. I’m loading it in
index.htmlfor the obvious reason that it needs to exist when you crash. It should go in the service workerpwa-manifest.jsontoo but I don’t know how to do that.I would have just put it inline but I don’t know how to position and scale an svg. Maybe this is much ado about too little and we should just use a Material Design Icon.
Update (2nd commit)
DocumentServicetest I broke (refactored for clarity)See it work
Todo