Platform: [Ivy] 9.0.0-beta.0 - Life Cycle Effects Hook loses context

Created on 12 Feb 2020  路  5Comments  路  Source: ngrx/platform

NgRX 9.0.0-beta.0 , Angular 9.0.0, Node 12.3.0:

The lifecycle ngrxOnInitEffects is broken - it loses the context of "this" so code inside that hook doesn't understand the class properties, methods, constructor injections -- Rolling back to 8.6.0 works.

Other information:

I would be willing to submit a PR to fix this issue

[ ] Yes (Assistance is provided if you need help submitting a pull request)
[x] No

9.x Effects bug

Most helpful comment

@jerryorta-dev fyi, this wasn't the cause of Ivy - see #2386 for more info

All 5 comments

Experiencing the same issue. This can be reproduced by adding an ngrxOnInitEffects to the NgRx example-app repo.

class AuthEffects implements OnInitEffects {
  ngrxOnInitEffects(): Action {
    return { type: '[Auth]: Auth Init' };
  }

initAuth$ = createEffect(() =>
    this.actions$.pipe(
      ofType('[Auth]: Auth Init'),
      tap(action => {
        console.log('test ngrxOnInitEffects');
      })
    ),
  { dispatch: false });
}

I haven't verified if this is the culprit, but there has been a change to OnInit in the v9 release - https://github.com/ngrx/platform/commit/a528320dc05fbe91959f91870535b1bd7487d142

@timdeschryver @brandonroberts when is the release date of NGRX 9 stable?

No specific release date yet, but soon-ish.

@jerryorta-dev fyi, this wasn't the cause of Ivy - see #2386 for more info

Was this page helpful?
0 / 5 - 0 ratings