File tree Expand file tree Collapse file tree 4 files changed +6
-261
lines changed Expand file tree Collapse file tree 4 files changed +6
-261
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import { cached } from '@glimmer/tracking';
44
55import { apiAction } from '@mainmatter/ember-api-actions' ;
66import { keepLatestTask , task } from 'ember-concurrency' ;
7- import fetch from 'fetch' ;
87import { alias } from 'macro-decorators' ;
98import semverParse from 'semver/functions/parse' ;
109
@@ -135,7 +134,7 @@ export default class Version extends Model {
135134
136135 loadReadmeTask = keepLatestTask ( async ( ) => {
137136 if ( this . readme_path ) {
138- let response = await fetch ( this . readme_path ) ;
137+ let response = await waitForPromise ( fetch ( this . readme_path ) ) ;
139138 if ( response . status === 404 || response . status === 403 ) {
140139 return ;
141140 }
@@ -144,7 +143,7 @@ export default class Version extends Model {
144143 throw new Error ( `README request for ${ this . crateName } v${ this . num } failed` ) ;
145144 }
146145
147- return await response . text ( ) ;
146+ return await waitForPromise ( response . text ( ) ) ;
148147 }
149148 } ) ;
150149
Original file line number Diff line number Diff line change 11import { runInDebug } from '@ember/debug' ;
2-
3- import fetch from 'fetch' ;
2+ import { waitForPromise } from '@ember/test-waiters' ;
43
54export default async function ajax ( input , init ) {
65 let method = init ?. method ?? 'GET' ;
76
87 let cause ;
98 try {
10- let response = await fetch ( input , init ) ;
9+ let response = await waitForPromise ( fetch ( input , init ) ) ;
1110 if ( response . ok ) {
12- return await response . json ( ) ;
11+ return await waitForPromise ( response . json ( ) ) ;
1312 }
1413 cause = new HttpError ( { url : input , method, response } ) ;
1514 } catch ( error ) {
@@ -68,7 +67,7 @@ export class AjaxError extends Error {
6867
6968 async json ( ) {
7069 try {
71- return await this . cause . response . json ( ) ;
70+ return await waitForPromise ( this . cause . response . json ( ) ) ;
7271 } catch {
7372 // ignore errors and implicitly return `undefined`
7473 }
Original file line number Diff line number Diff line change 102102 "ember-error-route" : " 0.2.0" ,
103103 "ember-event-helpers" : " 0.1.1" ,
104104 "ember-exam" : " 9.1.0" ,
105- "ember-fetch" : " 8.1.2" ,
106105 "ember-inflector" : " 6.0.0" ,
107106 "ember-keyboard" : " 9.0.1" ,
108107 "ember-link" : " 3.3.0" ,
You can’t perform that action at this time.
0 commit comments