You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
But if the promise fulfills as undefined, the code will break. This can happen in case the connection is getting lost during loading of the file or the file is not there at all.
@wittemann thanks for raising the issue. I raised a PR in #5762 with a fix for this. Note with this fix your code will still fail since the component can't be found.
Prerequisites
Stencil Version
master
Current Behavior
The error
is reported a lot in our error queue.
Expected Behavior
No error is reported.
System Info
Steps to Reproduce
I was not able to reproduce it with a stencil project but I went down the stencil code to analyze what is happening in I think I found the issue.
The root of the issue is located here:
if (BUILD.member && !Cstr.isProxied) {
https://github.com/ionic-team/stencil/blob/main/src/runtime/initialize-component.ts#L53
Cstr seems to be undefined. That variable is the result of a loadModule call
Cstr = loadModule(cmpMeta, hostRef, hmrVersionId);
In the error case, the call returns a promise as it should and you can see here
https://github.com/ionic-team/stencil/blob/main/src/client/client-load-module.ts#L45
Next the result is awaited here and overrides the promise with the actual content:
Cstr = await Cstr;
https://github.com/ionic-team/stencil/blob/main/src/runtime/initialize-component.ts#L47
But if the promise fulfills as undefined, the code will break. This can happen in case the connection is getting lost during loading of the file or the file is not there at all.
Usually the code like this breaks and throws an error but the error case of the dynamic loading of the module is already handles which means the code will continue as normal:
https://github.com/ionic-team/stencil/blob/main/src/client/client-load-module.ts#L56
I do have a standalone example to reproduce the issue:
Code Reproduction URL
https://codepen.io/wittemann/pen/xxNbeqK
Additional Information
Might be connected to #2774
The text was updated successfully, but these errors were encountered: