Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

[Auth Guard - BUG] canActivate auth guard causes blank screen after cache clear with multiple tabs opens.

Offen
#3,691 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
38/100
Issue-Typ
Bug
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
angular, firebase, typescript

Rechercherichtung

Beginne mit dem im Issue beschriebenen minimalen AngularFire-Authentifizierungssetup und verwende den canActivate-Guard mit redirectLoggedInTo und redirectUnauthorizedTo. Reproduziere das Verhalten mit zwei Tabs, leere in einem den Cache und aktualisiere ihn. Fertig ist es, wenn der aktualisierte Tab normal geladen wird, anstatt einen leeren Bildschirm anzuzeigen, während der andere Tab geöffnet bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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:

  1. Create new project
  2. install angular fire
  3. setup authentication and firebase project
  4. utilize the ...canActivate auth guard like below.
  5. open two tabs of the same page.
  6. in one of them, clear the cache (by using the button close to the url in chrome for ex)
  7. refresh
  8. blank screen.
  9. 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.

Vorherrschende Sprache
TypeScript
Sterne
7.8k
Forks
2.2k
Ø Merge
3 T. 6 Std.
Gemergte PRs (30 T.)
5

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus angular/angularfire

Alle Issues in angular/angularfire

Ähnliche Issues

Weitere Issues zu TypeScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.