Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught (in promise) LoadJS #51

Open
Swapnilchavan18 opened this issue Jul 19, 2017 · 11 comments
Open

Uncaught (in promise) LoadJS #51

Swapnilchavan18 opened this issue Jul 19, 2017 · 11 comments

Comments

@Swapnilchavan18
Copy link

loadjs(['https://test.com/js/fuploader.js'], 'photouploader');

while trying to load java-script file, I am getting error on single page react application.

@amorey
Copy link
Member

amorey commented Jul 19, 2017

What's the error you're getting? Also, which OS/Browser are you using?

@Swapnilchavan18
Copy link
Author

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.

@amorey
Copy link
Member

amorey commented Jul 19, 2017

Can you share code to re-create the error on JSFiddle or CodePen? By "navigating back" do you mean hitting the back button?

@Swapnilchavan18
Copy link
Author

Its single page application , I mean without refresh.

@amorey
Copy link
Member

amorey commented Jul 19, 2017

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.

@Swapnilchavan18
Copy link
Author

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

@amorey
Copy link
Member

amorey commented Jul 19, 2017 via email

@Swapnilchavan18
Copy link
Author

ok Thanks . give me some time, I am using that in my personal project, I will create fiddle

@SharlSherif
Copy link

SharlSherif commented Mar 17, 2019

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);
  }
}

@amorey
Copy link
Member

amorey commented Mar 17, 2019

@Sharl212 Thanks for letting us know. Can you share some example code that reproduces the problem?

@amorey
Copy link
Member

amorey commented Mar 18, 2019

@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()?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants