File tree Expand file tree Collapse file tree 3 files changed +21
-15
lines changed
Expand file tree Collapse file tree 3 files changed +21
-15
lines changed Original file line number Diff line number Diff line change @@ -127,20 +127,24 @@ export default Controller.extend({
127127 return data ;
128128 } ) ,
129129
130+ readme : alias ( 'loadReadmeTask.last.value' ) ,
131+
130132 loadReadmeTask : task ( function * ( ) {
131- try {
132- this . crate . set ( 'readme' , yield this . currentVersion . loadReadmeTask . perform ( ) ) ;
133-
134- if ( typeof document !== 'undefined' ) {
135- setTimeout ( ( ) => {
136- let e = document . createEvent ( 'CustomEvent' ) ;
137- e . initCustomEvent ( 'hashchange' , true , true ) ;
138- window . dispatchEvent ( e ) ;
139- } ) ;
140- }
141- } catch ( error ) {
142- this . crate . set ( 'readme' , null ) ;
133+ let version = this . currentVersion ;
134+
135+ let readme = version . loadReadmeTask . lastSuccessful
136+ ? version . loadReadmeTask . lastSuccessful . value
137+ : yield version . loadReadmeTask . perform ( ) ;
138+
139+ if ( typeof document !== 'undefined' ) {
140+ setTimeout ( ( ) => {
141+ let e = document . createEvent ( 'CustomEvent' ) ;
142+ e . initCustomEvent ( 'hashchange' , true , true ) ;
143+ window . dispatchEvent ( e ) ;
144+ } ) ;
143145 }
146+
147+ return readme ;
144148 } ) ,
145149
146150 documentationLink : computed (
Original file line number Diff line number Diff line change @@ -62,7 +62,9 @@ export default Route.extend({
6262 this . _super ( ...arguments ) ;
6363
6464 model . version . loadDepsTask . perform ( ) ;
65- controller . loadReadmeTask . perform ( ) ;
65+ controller . loadReadmeTask . perform ( ) . catch ( ( ) => {
66+ // ignored
67+ } ) ;
6668
6769 let { crate } = model ;
6870 if ( ! crate . documentation || crate . documentation . startsWith ( 'https://docs.rs/' ) ) {
Original file line number Diff line number Diff line change 5656 <CrateTomlCopy @copyText ={{ this.crateTomlText }} />
5757 {{ /if }}
5858 </div >
59- {{ #if this.crate. readme }}
59+ {{ #if this.readme }}
6060 <section local-class =" crate-readme" aria-label =" Readme" {{ highlight-syntax selector =" pre > code" }} >
61- {{ html-safe this.crate. readme }}
61+ {{ html-safe this.readme }}
6262 </section >
6363 {{ else }}
6464 {{ #if this.crate.description }}
You can’t perform that action at this time.
0 commit comments