Hi Team, We are facing one issue in the production build. Please have a look at the screenshot.
Steps to reproduce the issue:
1) Goto calendar lazy route. ( First time calendar is working. You will not see any error )
2) From calendar route goto abc lazy route
3) go back to the calendar lazy route again. (This time calendar is not going to work)
then you will see the errors which are displaying in the screenshot. But if you reload the page then you will not able to see the error.
core.js:6150 ERROR TypeError: Cannot read property 'some' of undefined
at o.value (calendar.lite.umd.js:31239)
at o.value (calendar.lite.umd.js:30844)
at o.value (calendar.lite.umd.js:30782)
at o.set [as resourcesData] (calendar.lite.umd.js:35018)
at o.set (calendar.lite.umd.js:27247)
at o.value (calendar.lite.umd.js:26197)
at o.value (calendar.lite.umd.js:26118)
at o.value (calendar.lite.umd.js:25756)
at o.value (calendar.lite.umd.js:30375)
at o.value (calendar.lite.umd.js:71106)
Hi @ core.js:6150
handleError @ core.js:6198
(anonymous) @ core.js:29519
invoke @ zone-evergreen.js:368
run @ zone-evergreen.js:130
runOutsideAngular @ core.js:28457
tick @ core.js:29519
(anonymous) @ core.js:29391
invoke @ zone-evergreen.js:368
onInvoke @ core.js:28528
invoke @ zone-evergreen.js:367
run @ zone-evergreen.js:130
run @ core.js:28412
next @ core.js:29390
i @ core.js:25882
__tryOrUnsub @ Subscriber.js:183
next @ Subscriber.js:122
_next @ Subscriber.js:72
next @ Subscriber.js:49
next @ Subject.js:39
emit @ core.js:25872
Ad @ core.js:28465
onHasTask @ core.js:28545
hasTask @ zone-evergreen.js:422
_updateTaskCount @ zone-evergreen.js:443
_updateTaskCount @ zone-evergreen.js:270
runTask @ zone-evergreen.js:191
m @ zone-evergreen.js:578
invokeTask @ zone-evergreen.js:487
h @ zone-evergreen.js:1596
f @ zone-evergreen.js:1633
load (async)
P @ zone-evergreen.js:1748
scheduleTask @ zone-evergreen.js:389
onScheduleTask @ zone-evergreen.js:279
scheduleTask @ zone-evergreen.js:382
scheduleTask @ zone-evergreen.js:217
scheduleEventTask @ zone-evergreen.js:243
(anonymous) @ zone-evergreen.js:1903
(anonymous) @ http.js:1793
_trySubscribe @ Observable.js:42
subscribe @ Observable.js:28
call @ map.js:16
subscribe @ Observable.js:23
call @ catchError.js:14
subscribe @ Observable.js:23
l @ innerSubscribe.js:67
_innerSub @ mergeMap.js:57
_tryNext @ mergeMap.js:51
_next @ mergeMap.js:34
next @ Subscriber.js:49
_next @ Subscriber.js:72
next @ Subscriber.js:49
_next @ Subscriber.js:72
next @ Subscriber.js:49
notifyNext @ mergeMap.js:70
_next @ innerSubscribe.js:10
next @ Subscriber.js:49
(anonymous) @ subscribeToPromise.js:5
invoke @ zone-evergreen.js:368
onInvoke @ core.js:28528
invoke @ zone-evergreen.js:367
run @ zone-evergreen.js:130
(anonymous) @ zone-evergreen.js:1272
invokeTask @ zone-evergreen.js:402
onInvokeTask @ core.js:28515
invokeTask @ zone-evergreen.js:401
runTask @ zone-evergreen.js:174
m @ zone-evergreen.js:578
invokeTask @ zone-evergreen.js:487
h @ zone-evergreen.js:1596
f @ zone-evergreen.js:1622
Show 40 more frames
core.js:6150 ERROR TypeError: Cannot read property 'eventStore' of undefined
at e.ngAfterViewInit (event-calendar-dashboard.component.ts:855)
at Lt (core.js:2521)
at Mt (core.js:2492)
at St (core.js:2443)
at rs (core.js:9478)
at core.js:10527
at rs (core.js:10520)
at Ls (core.js:10573)
at core.js:9204
at rs (core.js:9202)
Let me share the angular.json configuration with you.
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"allowedCommonJsDependencies": [],
"preserveSymlinks": true,
"outputPath": "dist/browser",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"styles": [
"src/styles.scss"
],
"scripts": [
]
},
"configurations": {
"calio": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.calio.ts"
}
],
"aot": true,
"optimization": true,
"outputHashing": "all",
"sourceMap": true,
"namedChunks": false,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true
}
}
}
TsConfig.json
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"downlevelIteration": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"module": "es2020",
"lib": [
"es2018",
"dom"
],
"noUnusedLocals": true
},
"angularCompilerOptions": {
"preserveWhitespaces": false
}
}
tsconfig.app.json
{
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "../out-tsc/app",
"types": [
"node",
"googlemaps"
]
},
"files": [
"main.ts",
"polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
}
Calendar code in afterViewInit
ngAfterViewInit(): void {
this.calendarInstance = this.calendar.calendarInstance;
this.eventStore = this.calendarInstance.eventStore;
LoggerService.log('before eventstore ', this.eventStore);
}