Skip to content

End User Agreement: infinite spinner after accepting on first login (Redux store race condition) #5471

@RenteriaMX

Description

@RenteriaMX

Description

After accepting the End User Agreement (EUA) on first login, the page shows an infinite spinner and never redirects to the original destination.

Environment

  • DSpace version: 9.x
  • dspace-angular version: 9.x

Steps to reproduce

  1. Create a new user (or administrator) who has never accepted the End User Agreement
  2. Log in for the first time
  3. The EUA page appears at /info/end-user-agreement?redirect=%252Fhome
  4. Check "I Accept" and click Submit
  5. Page shows infinite spinner — never redirects

Expected behavior

After accepting the EUA, the user is redirected to the original destination (e.g. /home).

Actual behavior

The PATCH to /api/eperson/epersons/{uuid} succeeds — dspace.agreements.end-user=true is correctly saved in the database. However, the frontend shows an infinite spinner.

On the next login, the user enters directly without seeing the EUA page, confirming the acceptance was saved correctly.

Root cause (investigated)

After the PATCH, the Angular Redux store reloads the user. During this brief window the store has no user (or stale user without the updated metadata) → the EUA guard fires again on the redirect to /home → redirects back to /info/end-user-agreement (this time without the redirect param) → spinner.

Double-encoding side note: The redirect URL is built in authorized.operators.ts with encodeURIComponent(redirect), but Angular already encodes query param values when building the URL → results in redirect=%252Fhome instead of redirect=%2Fhome. The decodeURIComponent() in end-user-agreement.component.ts correctly undoes this, so the double encoding is not the direct cause of the spinner — it is however confusing and worth fixing independently.

Relevant files

  • src/app/core/end-user-agreement/end-user-agreement.guard.ts
  • src/app/core/end-user-agreement/end-user-agreement.service.ts
  • src/app/info/end-user-agreement/end-user-agreement.component.tssubmit() method
  • src/app/core/shared/authorized.operators.tsreturnEndUserAgreementUrlTreeOnFalse

Workaround

Log out and log in again after the spinner appears. The EUA will not be shown again on subsequent logins.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    ✅ Done / Closed

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions