angular / angular/angularfire

signout function in ngrx effect with()

Open
#3,251 6 comments 4 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
7.8k
Forks
2.2k
Avg merge
22h 28m
Merged PRs (30d)
6

Description

Hello,
I have an NGRX in my project, and when I sign user out I got the error explained below, please notice that I use NGRX with:
```
runtimeChecks: {
strictStateImmutability: true,
strictActionImmutability: true,
},
```

### Version info

**Angular:**
~13.3.0
**Firebase:**
^9.1.0
**AngularFire:**
^7.2.1

### How to reproduce these conditions
auth.effects.ts:
```
clearLocalstorageOnLogout$ = createEffect(
() =>
this.actions$.pipe(
ofType(AuthActions.logout),
tap(async () => {
// @todo: there is a bug here
await this.firebaseAuth.signOut();
}),
),
{dispatch: false}
);

constructor(
private readonly actions$: Actions,
private firebaseAuth: Auth,
private router: Router,
) {
}
```

### Debug output

** Errors in the JavaScript console **
```
Unhandled Promise rejection: Cannot assign to read only property 'operations' of object '[object Object]' ; Zone: ; Task: Promise.then ; Value: TypeError: Cannot assign to read only property 'operations' of object '[object Object]'

Unhandled Promise rejection: Cannot assign to read only property 'isRunning' of object '[object Object]' ; Zone: ; Task: Promise.then ; Value: TypeError: Cannot assign to read only property 'isRunning' of object '[object Object]'
```
** Screenshots **
Screen Shot 1444-01-05 at 9 35 49 PM
Screen Shot 1444-01-05 at 9 35 41 PM

Contributor guide

Open the contributing guide

Research direction

Start with auth.effects.ts, especially clearLocalstorageOnLogout$, its createEffect pipeline, and the call to firebaseAuth.signOut(); reproduce the logout flow with the listed Angular, Firebase, and AngularFire versions and runtime checks enabled. Done means the signout flow completes without the reported read-only-property or unhandled-promise errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, firebase, typescript
Domain
authentication, frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.