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

Removed observable function calls from template (part 1) #3585

Conversation

alexandrevryghem
Copy link
Member

@alexandrevryghem alexandrevryghem commented Oct 29, 2024

References

Description

Currently, there are multiple instances where observable function calls are subscribed to directly in the template. This is considered a bad practice, as it cause a new Observable to be recreated each time Angular’s change detection is triggered. Some instances of this issue remain, but I will work on creating PRs to address them over the coming months.

Instructions for Reviewers

Guidance for how to test & review this PR:

  • Verify that the 4 linked issues have been resolved
  • Verify that all these functionalities still work correctly:
    • EPerson pages
    • Group pages
    • Bitstream Format Registry
    • Metadata Registry
    • A component that uses the pagination component

Checklist

  • My PR is created against the main branch of code (unless it is a backport or is fixing an issue specific to an older branch).
  • 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 npm run lint
  • My PR doesn't introduce circular dependencies (verified via npm run 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.
  • My PR aligns with Accessibility guidelines if it makes changes to the user interface.
  • My PR uses i18n (internationalization) keys instead of hardcoded English text, to allow for translations.
  • My PR includes details on how to test it. I've provided clear instructions to reviewers on how to successfully test this fix or feature.
  • 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.

@alexandrevryghem alexandrevryghem added bug high priority performance / caching Related to performance, caching or embedded objects component: Item (Archived) Item display or editing claimed: Atmire Atmire team is working on this issue & will contribute back port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release labels Oct 29, 2024
@alexandrevryghem alexandrevryghem added this to the 9.0 milestone Oct 29, 2024
@alexandrevryghem alexandrevryghem self-assigned this Oct 29, 2024
@alexandrevryghem alexandrevryghem force-pushed the w2p-117573_remove-observable-function-calls_contribute-main branch from 9ef1f65 to 0cb5b76 Compare October 29, 2024 17:48
@tdonohue tdonohue self-requested a review October 29, 2024 19:31
@tdonohue
Copy link
Member

tdonohue commented Nov 4, 2024

I'm beginning to wonder if #3584 might be caused by a similar issue. I'm not confident this PR would fix #3584, but the issue described in that ticket seems similar to the issues fixed by this PR.

Regardless, this is a high priority PR for me to get back to testing. Hoping to get to it sometime this week.

@kshepherd kshepherd self-requested a review November 5, 2024 14:17
@pilasou
Copy link
Contributor

pilasou commented Nov 7, 2024

Hi @alexandrevryghem, @tdonohue,
I have tested the 4 issues that the PR fixes following reviewer's instructions on each issue. All tests passed! I have used DSpace Docker, I was on main branch for Backend and on PR code branch for Angular.

Results for each issue:

  1. Opening the simple item page of a withdrawn item when logged in as administrator stalls the frontend instance #3393 : the item page displayed nearly immediatly.
  2. Browser hangs due to infinite loop when editing groups #3257 : the page is not frozen anymore and the corresponding group page is displayed.
  3. Lack of community/collection information when editing a person's access control #3571 : collection name appears in the table.
  4. "Researcher Profile" panel being displayed by default in DSpace 7.6.2 and DSpace 8.0 #3612 : the researcher profile section is not displayed annymore. Note that have not tested what happened if the Research Profile configuration is enabled (i.e Researcher profil section displays on the Profile page).

All those are very welcome fixes with no doubt! Thanks @alexandrevryghem

@pilasou
Copy link
Contributor

pilasou commented Nov 7, 2024

@tdonohue Following your comment (#3585 (comment)) on the potential impact of this PR against the #3584 issue, I have tried to reproduced the bug (on my DSpace Docker install, backend on Main branch) but was not able too. I followed the same step as on the video provided on the issue, I also clic on many different sections (list of collection, collection, item, etc.) but did not encounter the infinite loop bug. This said...more test required!

@saschaszott
Copy link
Contributor

@alexandrevryghem , I've merged the changes of this PR into main. The problem that is described in #3584 is not solved. I can safely reproduce the "infinite load" problem in my local dev instance.

@alexandrevryghem
Copy link
Member Author

@saschaszott: That's indeed a separate issue, this PR only fixes #3393, #3257, #3571 & #3612

@saschaszott
Copy link
Contributor

saschaszott commented Nov 8, 2024

@alexandrevryghem , thanks! I can confirm that #3393, #3257, #3571 are fixed by this PR.

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 ! Reviewed and tested this today. The code looks good to me. I tested that all 4 bugs are fixed. I also did some basic testing of the functionality of the EPerson/Group/Metadata Registry/Bitstream Registry, as those are the pages that were modified most significantly. No issues found, so this looks great to me.

Merging immediately as this has had several testers. This should be ported to 7.6.x and 8.x (to fix the same bugs there).

@tdonohue tdonohue merged commit f6d8446 into DSpace:main Nov 11, 2024
13 checks passed
@dspace-bot
Copy link
Contributor

Backport failed for dspace-7_x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin dspace-7_x
git worktree add -d .worktree/backport-3585-to-dspace-7_x origin/dspace-7_x
cd .worktree/backport-3585-to-dspace-7_x
git switch --create backport-3585-to-dspace-7_x
git cherry-pick -x 70f0af66117722e4d12d2b828ee85537946e69de d3019e4006aaa72f1dd8561a8d83050e48a9cebb 680ed3bccf38732ada602a7f01487c60035067ac b55686e1870cfb5083832239b5b2dbe18160c419 c74c178533d8ffd2c4cca926896b703e10af00b8 f03ed89687e12fa849e73b336e95fb2ab2996033 59e5f71a73053f8633446a1f43965ee99e4693f6 976ac7604be2458c31f92b6af05e94df453a74ea 0cb5b76159ce41b8b15192010ff7c89ab9911d21 ded0079f24e0f6670f357e545e9ff14219aa4913

@dspace-bot
Copy link
Contributor

Backport failed for dspace-8_x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally and resolve any conflicts.

git fetch origin dspace-8_x
git worktree add -d .worktree/backport-3585-to-dspace-8_x origin/dspace-8_x
cd .worktree/backport-3585-to-dspace-8_x
git switch --create backport-3585-to-dspace-8_x
git cherry-pick -x 70f0af66117722e4d12d2b828ee85537946e69de d3019e4006aaa72f1dd8561a8d83050e48a9cebb 680ed3bccf38732ada602a7f01487c60035067ac b55686e1870cfb5083832239b5b2dbe18160c419 c74c178533d8ffd2c4cca926896b703e10af00b8 f03ed89687e12fa849e73b336e95fb2ab2996033 59e5f71a73053f8633446a1f43965ee99e4693f6 976ac7604be2458c31f92b6af05e94df453a74ea 0cb5b76159ce41b8b15192010ff7c89ab9911d21 ded0079f24e0f6670f357e545e9ff14219aa4913

@tdonohue
Copy link
Member

tdonohue commented Nov 11, 2024

@alexandrevryghem : Could you manually port this to both 8.x and 7.6.x? It looks like it's too large to port automatically (it also could be that some bugs are specific to 8.x)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug claimed: Atmire Atmire team is working on this issue & will contribute back component: Item (Archived) Item display or editing high priority performance / caching Related to performance, caching or embedded objects port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release
Projects
Status: ✅ Done
5 participants