Ma77Ball opened a new issue, #5310:
URL: https://github.com/apache/texera/issues/5310

   ## 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):
   
   ```ts
   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
   1. Have the Flarum forum service unreachable or returning a non-404/500 
error.
   2. Log in and open the Forum (discussion) page.
   3. Observe the network tab: `forum/api/token` and `forum/api/users` fire 
repeatedly without end.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to