I keep getting an error You provided an invalid object where a stream was expected. You can provide an Observable, Promise, Array, or Iterable. when I try to access store in effect.
Code:
@Effect()
getHoles$ = this.actions$.pipe(
ofType<GetTreeHoles>(HolesActions.GetTreeHoles),
withLatestFrom(this.store.pipe(select(getLastDocumentSnapshot))),
...
It throws an error at the code:
exports.subscribeTo = function (result) {
if (result instanceof Observable_1.Observable) {
Apparently, type Store is not an instance of Observable. So it goes to error case like below:
else {
var value = isObject_1.isObject(result) ? 'an invalid object' : "'" + result + "'";
var msg = "You provided " + value + " where a stream was expected."
+ ' You can provide an Observable, Promise, Array, or Iterable.';
throw new TypeError(msg);
}
However, Store extends Observable.
The version I use:
"@ngrx/store": "^6.1.0",
"rxjs": "~6.2.0",
Not throw an error when trying to access store in effect.
"@ngrx/store": "^6.1.0",
"rxjs": "~6.2.0",
"@angular/common": "^6.1.0",
node version: v8.10.0
[ ] Yes (Assistance is provided if you need help submitting a pull request)
[x] No
Could you show your complete effects file?
And just to be sure, you're using ngrx/effects v6.1.0 right?
never mind. i figure out the issue.
I import from wrong path
instead of importing from import { catchError, switchMap, withLatestFrom } from 'rxjs/operators';
i imported from import { catchError, switchMap, withLatestFrom } from 'rxjs/internal/operators';
Most helpful comment
never mind. i figure out the issue.
I import from wrong path
instead of importing from
import { catchError, switchMap, withLatestFrom } from 'rxjs/operators';i imported from
import { catchError, switchMap, withLatestFrom } from 'rxjs/internal/operators';