所以,我在我的 redux 商店中使用一个“微调器”变量在我的进度条上插入一个带有 ngClass 的类并隐藏它/显示它。
现在 - 我知道这是罪魁祸首,因为如果我删除所有这些逻辑,一切都很好。这是一个已经投入生产几个月的应用程序,一切正常,直到升级到 A7。
- 我尝试使用 @select() 和 | 带有 ngIf 的异步管道。删除 ngIf 逻辑但保留微调器会使错误消失。
- 我尝试根据商店中的数据填充局部变量(如果为 true hiddenSpinner="hiddenSpinner" 否则 hiddenSpinner="")。删除标记中的所有相关内容不会使错误消失。
这让我觉得这纯粹是与 redux 逻辑有关。
如果我运行 ng serve --prod,一切都会运行良好。
所有相关的 redux 商店代码:
//INTERFACE TYPES
export interface IAppState {
spinner: boolean;
}
// DEFAULT STATE
export const INITIAL_STATE: IAppState = {
spinner: false
};
//ROOT REDUCER
export function rootReducer(state: IAppState, action): IAppState {
switch (action.type) {
case START_LOADING: return startLoading(state, action);
case STOP_LOADING: return stopLoading(state, action);
}
return state;
}
// FUNCTIONS FOR REDUCER TO CALL
function startLoading(state, action) {
return tassign(state, { spinner: true});
}
function stopLoading(state, action) {
return tassign(state, { spinner: false});
}
错误 :
ERROR TypeError: "e[n] is undefined"
unliftState http://localhost:4200/:2:30806
getState http://localhost:4200/:2:30882
storeToObservable http://localhost:4200/vendor.js:243:31
_trySubscribe http://localhost:4200/vendor.js:154754:20
subscribe http://localhost:4200/vendor.js:154740:17
subscribeTo http://localhost:4200/vendor.js:166005:24
subscribeToResult http://localhost:4200/vendor.js:166182:12
_innerSub http://localhost:4200/vendor.js:163001:34
_next http://localhost:4200/vendor.js:162991:9
next http://localhost:4200/vendor.js:155373:13
_next http://localhost:4200/vendor.js:160104:13
next http://localhost:4200/vendor.js:155373:13
_subscribe http://localhost:4200/vendor.js:154540:13
_trySubscribe http://localhost:4200/vendor.js:154754:20
_trySubscribe http://localhost:4200/vendor.js:155180:20
subscribe http://localhost:4200/vendor.js:154740:17
call http://localhost:4200/vendor.js:160081:16
subscribe http://localhost:4200/vendor.js:154735:13
call http://localhost:4200/vendor.js:162969:16
subscribe http://localhost:4200/vendor.js:154735:13
call http://localhost:4200/vendor.js:159541:16
subscribe http://localhost:4200/vendor.js:154735:13
call http://localhost:4200/vendor.js:160642:16
subscribe http://localhost:4200/vendor.js:154735:13
call http://localhost:4200/vendor.js:159541:16
subscribe http://localhost:4200/vendor.js:154735:13
ngOnInit http://localhost:4200/main.js:185:36
checkAndUpdateDirectiveInline http://localhost:4200/vendor.js:77713:9
checkAndUpdateNodeInline http://localhost:4200/vendor.js:78977:20
checkAndUpdateNode http://localhost:4200/vendor.js:78939:16
debugCheckAndUpdateNode http://localhost:4200/vendor.js:79573:19
debugCheckDirectivesFn http://localhost:4200/vendor.js:79533:13
View_AppComponent_Host_0 ng:///AppModule/AppComponent_Host.ngfactory.js:9:5
debugUpdateDirectives http://localhost:4200/vendor.js:79525:12
checkAndUpdateView http://localhost:4200/vendor.js:78921:5
callWithDebugContext http://localhost:4200/vendor.js:79815:22
debugCheckAndUpdateView http://localhost:4200/vendor.js:79493:12
detectChanges http://localhost:4200/vendor.js:77302:13
tick http://localhost:4200/vendor.js:73964:58
tick http://localhost:4200/vendor.js:73964:13
_loadComponent http://localhost:4200/vendor.js:73998:9
bootstrap http://localhost:4200/vendor.js:73940:9
_moduleDoBootstrap http://localhost:4200/vendor.js:73741:74
_moduleDoBootstrap http://localhost:4200/vendor.js:73741:13
bootstrapModuleFactory http://localhost:4200/vendor.js:73709:21
invoke http://localhost:4200/polyfills.js:9654:17
onInvoke http://localhost:4200/vendor.js:73236:24
invoke http://localhost:4200/polyfills.js:9653:17
run http://localhost:4200/polyfills.js:9404:24
scheduleResolveOrReject http://localhost:4200/polyfills.js:10138:29
invokeTask http://localhost:4200/polyfills.js:9687:17
onInvokeTask http://localhost:4200/vendor.js:73227:24
invokeTask http://localhost:4200/polyfills.js:9686:17
runTask http://localhost:4200/polyfills.js:9454:28
drainMicroTaskQueue http://localhost:4200/polyfills.js:9861:25
core.js:12584
defaultErrorLogger
core.js:12584
./node_modules/@angular/core/fesm5/core.js/ErrorHandler.prototype.handleError
core.js:12632
next
core.js:14611:109
./node_modules/@angular/core/fesm5/core.js/EventEmitter.prototype.subscribe/schedulerFn<
core.js:10238:34
./node_modules/rxjs/_esm5/internal/Subscriber.js/SafeSubscriber.prototype.__tryOrUnsub
Subscriber.js:196
./node_modules/rxjs/_esm5/internal/Subscriber.js/SafeSubscriber.prototype.next
Subscriber.js:134
./node_modules/rxjs/_esm5/internal/Subscriber.js/Subscriber.prototype._next
Subscriber.js:77
./node_modules/rxjs/_esm5/internal/Subscriber.js/Subscriber.prototype.next
Subscriber.js:54
./node_modules/rxjs/_esm5/internal/Subject.js/Subject.prototype.next
Subject.js:47
./node_modules/@angular/core/fesm5/core.js/EventEmitter.prototype.emit
core.js:10222:52
onHandleError/<
core.js:14165:48
./node_modules/zone.js/dist/zone.js/</ZoneDelegate.prototype.invoke
zone.js:388
./node_modules/zone.js/dist/zone.js/</Zone.prototype.run
zone.js:138
./node_modules/@angular/core/fesm5/core.js/NgZone.prototype.runOutsideAngular
core.js:14102
onHandleError
core.js:14165
./node_modules/zone.js/dist/zone.js/</ZoneDelegate.prototype.handleError
zone.js:392
./node_modules/zone.js/dist/zone.js/</Zone.prototype.runTask
zone.js:191
./node_modules/zone.js/dist/zone.js/</ZoneTask.invokeTask
zone.js:496
ZoneTask/this.invoke
zone.js:485
timer
zone.js:2054