IE11中的第一个Fetch API调用被第二个取消 [英] First Fetch API call cancelled by the second in IE11

查看:102
本文介绍了IE11中的第一个Fetch API调用被第二个取消的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个ReactJS应用程序,该应用程序可以在Chrome中正常运行,但在IE-11中无法运行.

I have a ReactJS application that works as expected in Chrome, but fails in IE-11.

问题是这样的-当页面首次加载时,我们有两个下拉列表,这些列表是从rest服务填充的.该应用程序在SSL下运行.通过IE-11加载页面时,出现了IE-11错误问题,其中第一个请求调用被第二个取消,该错误的描述如下:

The problem is this - we have two drop down lists which are populated from rest services when the page is first loaded. The application is running under SSL. When the page is loaded through IE-11, I get an IE-11 bug issue where the first request call gets cancelled out by the second-the bug is described here:

https://developer.microsoft.com/zh-cn/microsoft-edge/platform/issues/1282036/

所以,我只是问社区是否有针对IE-11的解决方案,或者是否有计划按顺序实施我的代码?如果第一个完成,第二个称为:

So, I am just asking the community whether there is a work around for IE-11 or is there away to implement my code sequentially where if the first is complete the second is called:

export let getMainData = (dtType, url)=> {
    return dispatch=>{
           dispatch(sendGet(dtType));
           const action = (async(url) => {
                  const response = await fetch(url);
                     let data = await response.json();
                        dispatch(receiveGet(dtType,data));
         });
       action(url);
     };
};

上面的代码是通用代码,在React App中被其他人使用.因此,我在想如果没有一个抽象级别,两个下拉列表可以依次调用,然后在下面调用上面的列表呢?

The code above is common code and is used by others in the React App. So what I am thinking if there is away to have a level of abstraction where the two drop down lists can call sequentially and then call the above underneath, perhaps?

推荐答案

只需包含isomorphic-fetch作为polyfill,即可在不受支持的浏览器上使用.

Just include isomorphic-fetch as polyfill to make it work on unsupported browsers.

https://github.com/matthew-andrews/isomorphic-fetch

这篇关于IE11中的第一个Fetch API调用被第二个取消的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆