loadjs
loadjs copied to clipboard
Uncaught (in promise) LoadJS
loadjs(['https://test.com/js/fuploader.js'], 'photouploader');
while trying to load java-script file, I am getting error on single page react application.
What's the error you're getting? Also, which OS/Browser are you using?
I am using chrome/windows 10, file loads on first load but when navigated back to same route where I am loading file, I get error "Uncaught (in promise) LoadJS" and js file does not load. I think it happens because file has to load from cache.
Can you share code to re-create the error on JSFiddle or CodePen? By "navigating back" do you mean hitting the back button?
Its single page application , I mean without refresh.
Can you share code to reproduce the error? Does the fuploader.js
file matter or are you getting the same error with other files?
I need more information to be able to debug the problem or recommend a work-around.
Is there anything that I have to do in componentWillUnmount to load files when there is not a refresh between pages i.e for single page app
Based on your description I can't make any recommendations. If you can share some example code I can help you diagnose the problem. Can you paste the code into GitHub?
On Jul 19, 2017, at 12:32 PM, Swapnilchavan18 [email protected] wrote:
Is there anything that I have to do in componentWillUnmount to load files when there is not a refresh between pages i.e for single page app
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.
ok Thanks . give me some time, I am using that in my personal project, I will create fiddle
got the same exact error when loading js
files on componentWillMount
, it works the first time the component mounts after remounting again , it throws Uncaught (in promise) LoadJS --- asyncToGenerator.js:6
in the console
.
the asyncToGenerator.js
:
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error); // error is thrown by this
return;
}
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
@Sharl212 Thanks for letting us know. Can you share some example code that reproduces the problem?
@Sharl212 @Swapnilchavan18 Based on your description of the problem I think the issue might be that each call to componentWillMount()
defines a LoadJS bundle but LoadJS throws an error when you try to reuse a previously used bundle name. Here's an example that highlights this condition:
https://jsfiddle.net/muicss/2d9ryjfp/
In your code, are you defining a bundle name when you call loadjs()
?