Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Opening the simple item page of a withdrawn item when logged in as administrator stalls the frontend instance #3393

Open
MW3000 opened this issue Oct 9, 2024 · 5 comments · May be fixed by #3585
Assignees
Labels
affects: main Issue impacts "main" (latest release). affects: 8.x Issue impacts 8.x releases bug claimed: Atmire Atmire team is working on this issue & will contribute back component: Item (Archived) Item display or editing high priority

Comments

@MW3000
Copy link
Contributor

MW3000 commented Oct 9, 2024

Describe the bug

In DSpace 8.x, opening the simple item page of a withdrawn item when logged in as administrator stalls the frontend instance for about 10 to 15 minutes, making it unresponsive, then continues to display the simple item page.

To Reproduce

Steps to reproduce the behavior:

  1. Login as an administrator
  2. Withdraw an item
  3. Go the withdrawn item's simple item page, eg. by clicking the item in the breadcrumbs, searching for a withdrawn item in administrative search or because you copied the url beforehand.
  4. The whole frontend instance stalls for about 10 to 15 minutes. After that time, the simple item page is displayed.

You can easily reproduce this on the DSpace Demo Website

Expected behavior

The simple item page should come up immediately

@MW3000 MW3000 added bug needs triage New issue needs triage and/or scheduling labels Oct 9, 2024
@tdonohue tdonohue added high priority component: Item (Archived) Item display or editing help wanted Needs a volunteer to claim to move forward affects: 8.x Issue impacts 8.x releases and removed needs triage New issue needs triage and/or scheduling labels Oct 9, 2024
@Leano1998
Copy link
Contributor

Hi,
I looked a bit deeper into this and figured, it might be a problem with the cache of the authorization information:

  showReinstateButton$(): Observable<boolean>  {
    const correction$ = this.correctionTypeDataService.findByItem(this.item.uuid, true).pipe(
      getFirstCompletedRemoteData(),
      map((correctionTypeRD: RemoteData<PaginatedList<CorrectionType>>) => correctionTypeRD.hasSucceeded ? correctionTypeRD.payload.page : []),
    );
    const isAdmin$ = this.authService.isAuthorized(FeatureID.AdministratorOf);
    return combineLatest([isAdmin$, correction$]).pipe(
      map(([isAdmin, correction]) => {
        return !isAdmin && correction.some((correctionType) => correctionType.topic === REQUEST_REINSTATE);
      },
      ));
  }

If I force the authService not to use the cached version, it works for me, otherwise it seems to return undefined.

    const isAdmin$ = this.authService.isAuthorized(FeatureID.AdministratorOf, undefined, undefined, false);

@alexandrevryghem
Copy link
Member

@Leano1998: The problem is most likely that the template always recreates a new Observable every time the template is rerenderd. I already have a branch with similar fixes on other places that I was going to contribute, I can add that fix to that branch too 🤷

<a *ngIf="showReinstateButton$() | async" class="btn btn-primary btn-sm" (click)="openReinstateModal()">{{ 'item.alerts.reinstate-request' | translate}}</a>

@alexandrevryghem alexandrevryghem self-assigned this Oct 10, 2024
@alexandrevryghem alexandrevryghem added the claimed: Atmire Atmire team is working on this issue & will contribute back label Oct 10, 2024
@Leano1998
Copy link
Contributor

@alexandrevryghem : Yes, I noticed this behavior in the browser console. Thank you for the adding the fix!

@tdonohue tdonohue removed the help wanted Needs a volunteer to claim to move forward label Oct 10, 2024
@alanorth
Copy link
Contributor

alanorth commented Oct 14, 2024

Interesting... I haven't noticed this on DSpace 7.6.x. We have many withdrawn items so I would have definitely run into this.

@alexandrevryghem
Copy link
Member

Indeed, only dspace-8_x and main are affected since this originates from this PR, which hasn't been backported to dspace-7_x.

@tdonohue tdonohue added the affects: main Issue impacts "main" (latest release). label Oct 14, 2024
@alexandrevryghem alexandrevryghem linked a pull request Oct 29, 2024 that will close this issue
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: main Issue impacts "main" (latest release). affects: 8.x Issue impacts 8.x releases bug claimed: Atmire Atmire team is working on this issue & will contribute back component: Item (Archived) Item display or editing high priority
Projects
Status: 🏗 In Progress
Development

Successfully merging a pull request may close this issue.

5 participants