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

Fixed delete item page freezing when having relationships #3079

Conversation

alexandrevryghem
Copy link
Member

References

Description

Fixed performance issues that cause the delete item page to completely break when it has relationships. This was because it subscribed to functions returning Observables. While fixing this bug I also saw that accessing an edit item page with an invalid ID would not redirect you to the 404 page so I also fixed this. Also fixed the issue that prevented the user from being redirected when selecting some virtual metadata to copy

Instructions for Reviewers

List of changes in this PR:

  • Fixed the delete item page completely freezing by creating two new DTO classes: RelationshipTypeDTO & RelationshipDTO. Theses classes will contain all the Observables that are needed in the HTML template. By saving this in one object we prevent resubscribing to all those observables every time change detection is triggered
  • Fixed issue where a white page would be shown when accessing the edit item pages from a deleted item (also happens for community & collection pages, I'll add a fix for this later as well)
  • Disabled the cancel & delete button when deleting an item to prevent double submissions
  • Fixed issue where the user wasn't redirected after selecting some virtual metadata that should persist after the item deletion. This was caused because the DeleteDataImpl#deleteByHref method invalidated the delete item URL instead of the get item URL. This caused the method to never emit when copyVirtualMetadata had values.

Guidance for how to test & review this PR:

  • Create 2 items and create a relationship between them
  • Select the entity type for which the virtual metadata should be kept as plaintext metadata
  • Copy the URL in you browser & click on delete at the bottom
  • Verify That you were now automatically redirect to the home page & that the URL that you copied automatically redirect you to the 404 page

Checklist

  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using yarn lint
  • My PR doesn't introduce circular dependencies (verified via yarn check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

….6' into w2p-115427_fixed-delete-item-page-freezing_contribute-main

 Conflicts:
	src/app/item-page/edit-item-page/item-delete/item-delete.component.ts
	src/app/item-page/full/full-item-page.component.spec.ts
	src/app/item-page/full/full-item-page.component.ts
	src/app/item-page/item-page.resolver.spec.ts
	src/app/item-page/item-page.resolver.ts
	src/app/item-page/simple/item-page.component.spec.ts
	src/app/item-page/simple/item-page.component.ts
…ontribute-7.6' into w2p-115427_fixed-delete-item-page-freezing_contribute-main
@alexandrevryghem alexandrevryghem self-assigned this May 27, 2024
@alexandrevryghem alexandrevryghem added bug component: configurable entities related to configurable entities high priority testathon Reported by a tester during Community Testathon port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release labels May 27, 2024
@tdonohue tdonohue self-requested a review May 28, 2024 13:23
@tdonohue tdonohue added the 1 APPROVAL pull request only requires a single approval to merge label May 28, 2024
@tdonohue tdonohue added this to the 8.0 milestone May 28, 2024
Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks @alexandrevryghem ! Tested this fix today and it fixes the bug, along with the other issues you've noted in the description. Code looks good too

@tdonohue tdonohue merged commit a5b9477 into DSpace:main May 29, 2024
13 checks passed
@dspace-bot
Copy link
Contributor

Successfully created backport PR for dspace-7_x:

@alexandrevryghem alexandrevryghem removed the port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release label May 29, 2024
@alexandrevryghem alexandrevryghem deleted the w2p-115427_fixed-delete-item-page-freezing_contribute-main branch May 29, 2024 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 APPROVAL pull request only requires a single approval to merge bug component: configurable entities related to configurable entities high priority testathon Reported by a tester during Community Testathon
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Cannot Delete an Entity which has Relationships
3 participants