Skip to content

@ngrx/effects fires same request twice #1190

@oxiumio

Description

@oxiumio

Minimal reproduction of the bug/regression with instructions:

There is a similar issue closed with indication 'works as designed', but it appears not to work that way at least on my end.

Here's a reproduction of the issue:
https://stackblitz.com/edit/angular-gfh6pn

One remark regarding throttle operator in the effects - if commented out, effect fires POST request, cancels it immediately, then fires pre-flight and POST again.
With throttle, there are no cancelled requests, but both pre-flight and POST are duplicated.

In the similar issue closed there were a couple of suggestions to tackle this behavior:

  • use .share() - does not help the issue in my case
  • avoid importing EffectsModule.forRoot(), but provide effects class in providers array - does not work at all, effects are not evaluated
  • avoid double subscription, which I seem not to have in my case

Expected behavior:

pre-flight request followed by an actual request each time action is triggered, no duplicated requests

Versions of NgRx, Angular, Node, affected browser(s) and operating system(s):

  • NgRx related dependencies:
    "@ngrx/core": "^1.2.0",
    "@ngrx/effects": "^6.0.1",
    "@ngrx/store": "^6.0.1",
    "@ngrx/store-devtools": "^6.0.1",
    "@ngrx/store-log-monitor": "^3.0.2"
  • Angular 6.0.9
  • Node 10.0.0
  • Chrome Version 67.0.3396.99 (Official Build) (64-bit)
  • macOs High Sierra 10.13.6

Other information:

None

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions