Fix/deprioritize image requests (#638)
* Use "fetch" instead of "axios"
Axios does not support prioritizing requests
* Deprioritize image requests
The browser requests images (<img>) with low priority by default.
Due to switching to loading images via axios (f852ce70e7), the image requests had the same priority as other requests and thus blocked e.g. xhr requests
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
import { AxiosInstance } from 'axios';
|
||||
import {
|
||||
ApolloError,
|
||||
ApolloQueryResult,
|
||||
@@ -370,13 +369,13 @@ export class RequestManager {
|
||||
return this.restClient;
|
||||
}
|
||||
|
||||
public updateClient(config: Partial<AxiosInstance['defaults']>): void {
|
||||
public updateClient(config: RequestInit): void {
|
||||
this.restClient.updateConfig(config);
|
||||
this.graphQLClient.updateConfig();
|
||||
}
|
||||
|
||||
public getBaseUrl(): string {
|
||||
return this.restClient.getClient().defaults.baseURL!;
|
||||
return this.restClient.getBaseUrl();
|
||||
}
|
||||
|
||||
public getValidUrlFor(endpoint: string, apiVersion: string = RequestManager.API_VERSION): string {
|
||||
@@ -764,8 +763,13 @@ export class RequestManager {
|
||||
const response = this.restClient
|
||||
.fetcher(url, {
|
||||
checkResponseIsJson: false,
|
||||
config: { signal, responseType: 'blob' },
|
||||
config: {
|
||||
signal,
|
||||
// @ts-ignore - typing has not been updated yet
|
||||
priority: 'low',
|
||||
},
|
||||
})
|
||||
.then((data) => data.blob())
|
||||
.then((data) => URL.createObjectURL(data));
|
||||
|
||||
return { response, abortRequest };
|
||||
|
||||
Reference in New Issue
Block a user