[Auth Guard - BUG] canActivate auth guard causes blank screen after cache clear with multiple tabs opens.
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- angular, firebase, typescript
- Domain
- authentication, frontend
Research direction
Start with the minimal AngularFire authentication setup described in the issue, using the canActivate guard with redirectLoggedInTo and redirectUnauthorizedTo. Reproduce the behavior with two tabs, clear the cache in one, and refresh it. Done means the refreshed tab loads normally instead of showing a blank screen while the other tab remains open.
Written by the indexing model from the issue text.
Description
If using the canActivate auth guard (with spread syntax), If you have more than 1 tab open of the same app, and then you clear the cache by using the browser in one of the tabs, and try to refresh, it causes a blank screen, which resolves after you close the other open tab.
steps to reproduce:
versions:
"@angular/common": "^20.3.0",
"@angular/compiler": "^20.3.0",
"@angular/core": "^20.3.0",
"@angular/fire": "^20.0.1",
"@angular/forms": "^20.3.0",
"@angular/platform-browser": "^20.3.0",
"@angular/router": "^20.3.0",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.15.0"
steps to reproduce:
- Create new project
- install angular fire
- setup authentication and firebase project
- utilize the ...canActivate auth guard like below.
- open two tabs of the same page.
- in one of them, clear the cache (by using the button close to the url in chrome for ex)
- refresh
- blank screen.
- verify that if you close the second tab, then the first one loads correctly.
const redirectTeste1 = () => redirectLoggedInTo('test2');
const redirectTeste2 = () => redirectUnauthorizedTo('teste1');
export const routes: Routes = [
{ path: '', redirectTo: 'teste1', pathMatch: 'full' },
{
path: 'teste1',
component: Test1,
...canActivate(redirectTeste1),
},
{
path: 'teste2',
component: Test2,
...canActivate(redirectTeste2),
},
];
lmk if this is somehow a user error, but with such a barebones configuration I think is a legitimate bug.
- Dominant language
- TypeScript
- Stars
- 7.8k
- Forks
- 2.1k
- Avg merge
- 2d 22h
- Merged PRs (30d)
- 25
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from angular/angularfire
-
comp: compat comp: firestore comp: storage type: chore
Difficulty 4/5 3-5 days Newbie friendliness 48/100
angular/angularfire#3822 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 55/100
angular/angularfire#3800 · 1 reaction ·
Maintainers usually reply within 3 days
-
Use `TransferState` to hand server-rendered Firestore data to the browser, instead of reading every document twiceMay be free again @armando-navarro claimed this 75 days ago, and no pull request is open. Opencomp: firestore comp: ssr priority: P0 (critical) type: feature version: current (v17+)
angular/angularfire#3757 · 1 assignee ·
Maintainers usually reply within 3 days
-
Six `firebase` entry points have no `@angular/fire` equivalent, so their exports are unreachableMay be free again @armando-navarro claimed this 75 days ago, and no pull request is open. Opencomp: core type: feature
angular/angularfire#3755 · 1 assignee ·
Maintainers usually reply within 3 days
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
angular/angularfire#3737 · 4 comments · 26 reactions ·
Maintainers usually reply within 3 days
All issues in angular/angularfire
Similar issues
-
bug parity
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
WenyuChiou/agent-board#1489 ·
Maintainers usually reply within 1 day
-
area: bazaar bug complexity: medium
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
accensa/x402-facilitator-stellar#779 ·
Maintainers usually reply within 1 day
-
bug good first issue P4 size:S web-ui
Difficulty 2/5 Half a day Newbie friendliness 85/100
josephfung/curia#2600 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
cloudflare/partykit#444 ·