Huge ngrx createEffect causes a strange error after upgrade, which disappears if different pieces of code such as tap or filter are commented

huangapple go评论110阅读模式
英文:

Huge ngrx createEffect causes a strange error after upgrade, which disappears if different pieces of code such as tap or filter are commented

问题

I'm upgrading a huge Angular 12 project to Angular 13 and did many steps.
Effects were also rewritten in a newer way such as

createEffect(() =>
instead of

@Effect

Unfortunately, the upgrade caused several effects to be broken. The fast fix to avoid errors and run the app was to apply { dispatch: false }. Unfortunately, that was not a fix and it broke the logic. I've tried to fix each broken effect step by step. For one huge effect the error is:
Huge ngrx createEffect causes a strange error after upgrade, which disappears if different pieces of code such as tap or filter are commented
which unexpectedly gets fixed by commenting

filter(...),
block, or another filter(...), block, or tap(..) in this large and long (many lines) Effect.

Are there limitations that I'm missing? Why is this error happening? Why it gets fixed by commenting simple pieces of this Effect?

As an example, if I comment any of several filters in different places, as an example this (params are renamed):

// filter(
// ([
// param1,
// param2,
// param3,
// param4,
// param5,
// param6,
// param7,
// param8,
// param9,
// param10,
// param11,
// param12
// ]) => !!param11.id
// ),

the error disappears:
Huge ngrx createEffect causes a strange error after upgrade, which disappears if different pieces of code such as tap or filter are commented

英文:

I'm upgrading a huge Angular 12 project to Angular 13 and did many steps.
Effects were also rewritten in a newer way such as

createEffect(() =>

instead of

@Effect

Unfortunately, the upgrade caused several effects to be broken. The fast fix to avoid errors and run the app was to apply { dispatch: false }. Unfortunately, that was not a fix and it broke the logic. I've tried to fix each broken effect step by step. For one huge effect the error is:
Huge ngrx createEffect causes a strange error after upgrade, which disappears if different pieces of code such as tap or filter are commented
which unexpectedly gets fixed by commenting

filter(...),

block , or another filter(...), block, or tap(..) in this large and long (many lines) Effect.

Are there limitations that I'm missing? Why is this error happening? Why it gets fixed by commenting simple pieces of this Effect?

As example, if I comment any of several filters in different places, as example this (params are renamed):

// filter(
//   ([
//     param1,
//     param2,
//     param3,
//     param4,
//     param5,
//     param6,
//     param7,
//     param8,
//     param9,
//     param10,
//     param11,
//     param12
//   ]) => !!param11.id
// ),

the error disappears:
Huge ngrx createEffect causes a strange error after upgrade, which disappears if different pieces of code such as tap or filter are commented

答案1

得分: 0

Adding any has helped:

createEffect((): any => this.actions$.pipe(

英文:

Adding any has helped:

createEffect((): any => this.actions$.pipe(

huangapple
  • 本文由 发表于 2023年3月15日 19:26:33
  • 转载请务必保留本文链接:https://go.coder-hub.com/75744060.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定