Time to time I am getting an undefined error when a few of JS scripts (static resources) are loaded. The error is faced only the first time the component is loaded. It means, after the error is faced if the component is closed and the page is refreshed then,the next time is working perfectly.
This is the piece of code:
renderedCallback() {
if (this.fullCalendarJsInitialised) {
return;
}
this.fullCalendarJsInitialised = true;
Promise.all([
loadScript(this, FullCalendarJS + '/jquery.min.js'),
loadScript(this, FullCalendarJS + '/moment.min.js'),
loadScript(this, FullCalendarJS + '/theme.js'),
loadScript(this, FullCalendarJS + '/fullcalendar.min.js'),
loadStyle(this, FullCalendarJS + '/fullcalendar.min.css'),
])
.then(() => {
})
.catch(error => {
console.error({
message: 'Error occured on FullCalendarJS',
error
});
})
}
This is what the browser's console is shown when the error is faced, as we can see the console error message is printed, but at the same time, all the scripts appears with the status code 200...Does this make sense??
Any idea?
Note: Disabling the cache in the browser’s console** the error appears time to time** during the first time load, so it is not easy to replicate.