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({
127
127
return data ;
128
128
} ) ,
129
129
130
+ readme : alias ( 'loadReadmeTask.last.value' ) ,
131
+
130
132
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
+ } ) ;
143
145
}
146
+
147
+ return readme ;
144
148
} ) ,
145
149
146
150
documentationLink : computed (
Original file line number Diff line number Diff line change @@ -62,7 +62,9 @@ export default Route.extend({
62
62
this . _super ( ...arguments ) ;
63
63
64
64
model . version . loadDepsTask . perform ( ) ;
65
- controller . loadReadmeTask . perform ( ) ;
65
+ controller . loadReadmeTask . perform ( ) . catch ( ( ) => {
66
+ // ignored
67
+ } ) ;
66
68
67
69
let { crate } = model ;
68
70
if ( ! crate . documentation || crate . documentation . startsWith ( 'https://docs.rs/' ) ) {
Original file line number Diff line number Diff line change 56
56
<CrateTomlCopy @copyText ={{ this.crateTomlText }} />
57
57
{{ /if }}
58
58
</div >
59
- {{ #if this.crate. readme }}
59
+ {{ #if this.readme }}
60
60
<section local-class =" crate-readme" aria-label =" Readme" {{ highlight-syntax selector =" pre > code" }} >
61
- {{ html-safe this.crate. readme }}
61
+ {{ html-safe this.readme }}
62
62
</section >
63
63
{{ else }}
64
64
{{ #if this.crate.description }}
You can’t perform that action at this time.
0 commit comments