Describe the bug
The Forum / discussion page (/dashboard/user/discussion) causes the frontend to loop over and over again — it repeatedly fires forum/api/token (auth) and forum/api/users (register) requests in an infinite cycle instead of loading the forum.
Root cause
forumLogin() in frontend/src/app/dashboard/component/dashboard.component.ts (lines ~205-226):
forumLogin() {
if (!document.cookie.includes("flarum_remember") && this.isLogin) {
this.flarumService.auth().pipe(untilDestroyed(this)).subscribe({
next: (response: any) => {
document.cookie = `flarum_remember=${response.token};path=/`;
},
error: (err: unknown) => {
if ([404, 500].includes((err as HttpErrorResponse).status)) {
this.displayForum = false;
} else {
this.flarumService.register()
.pipe(untilDestroyed(this))
.subscribe(() => this.forumLogin()); // recursive call
}
},
});
}
}
When auth() fails with any status other than 404/500 (e.g. network/CORS failure with status 0, or 401), the error branch calls register() and then recursively calls forumLogin(). Since auth() keeps failing, the cookie is never set and the guard never short-circuits, so it loops forever — auth → register → auth → register → … This is the observed repeated looping.
Expected behavior
The forum login should attempt registration at most once and stop on persistent failure (hide the forum / surface an error) rather than retrying indefinitely.
Steps to reproduce
- Have the Flarum forum service unreachable or returning a non-404/500 error.
- Log in and open the Forum (discussion) page.
- Observe the network tab:
forum/api/token and forum/api/users fire repeatedly without end.
Describe the bug
The Forum / discussion page (
/dashboard/user/discussion) causes the frontend to loop over and over again — it repeatedly firesforum/api/token(auth) andforum/api/users(register) requests in an infinite cycle instead of loading the forum.Root cause
forumLogin()infrontend/src/app/dashboard/component/dashboard.component.ts(lines ~205-226):When
auth()fails with any status other than 404/500 (e.g. network/CORS failure with status0, or401), the error branch callsregister()and then recursively callsforumLogin(). Sinceauth()keeps failing, the cookie is never set and the guard never short-circuits, so it loops forever — auth → register → auth → register → … This is the observed repeated looping.Expected behavior
The forum login should attempt registration at most once and stop on persistent failure (hide the forum / surface an error) rather than retrying indefinitely.
Steps to reproduce
forum/api/tokenandforum/api/usersfire repeatedly without end.