Skip to content

[DURACOM-350] fix cache issue after mydspace action#4234

Merged
tdonohue merged 3 commits intoDSpace:mainfrom
4Science:task/main/DURACOM-350
Apr 24, 2025
Merged

[DURACOM-350] fix cache issue after mydspace action#4234
tdonohue merged 3 commits intoDSpace:mainfrom
4Science:task/main/DURACOM-350

Conversation

@FrancescoMolinaro
Copy link
Copy Markdown
Contributor

References

Fixes #4205

Description

This PR fixes a cache issue that occurs after executing any reloadable action in MyDSpace.
The problem arises because we update the rendered results immediately—so the item becomes visible right away—but we don't invalidate the cache. As a result, when the same search request is triggered again (for example, by switching between configurations), the cached data causes a mismatch in the item's render type. This leads to an empty list element appearing in the DOM.

So following the same logic we have on the reload method in src/app/shared/mydspace-actions/mydspace-actions.ts, I have applied a cache invalidation happening after any of the reloadable actions in MyDSpace.

Regarding the second problem mentioned in the issue, the one describing a duplicated search result, I belive is actually a duplicated item as we can also see from the banner in the item preview:

duplicated-workflow-items

Instructions for Reviewers

List of changes in this PR:

Added method to invalidate cache after success of reloadable action.

To reproduce:

Navigate to the "Workflow tasks" view.
Claim one of the available workflow items.
Switch to another discovery configuration.
Return to the "Workflow tasks" view.

Expectation:

The list of items is rendered correctly and the items have the correct status.

Checklist

This checklist provides a reminder of what we are going to look for when reviewing your PR. You do not need to complete this checklist prior creating your PR (draft PRs are always welcome).
However, reviewers may request that you complete any actions in this list if you have not done so. If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!

  • 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.

@tdonohue tdonohue added bug component: workflow 1 APPROVAL pull request only requires a single approval to merge labels Apr 23, 2025
@tdonohue tdonohue moved this to 🙋 Needs Reviewers Assigned in DSpace 9.0 Release Apr 23, 2025
Copy link
Copy Markdown
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.

@FrancescoMolinaro : I tested this today & it fixes the described bug. However, I noticed while testing that if you switch from one MyDSpace view ("Workflow Tasks") to another ("Your submissions"), the sidebar Filters list is failing to load at times like this:

filters-missing

It looks like this is also occurring on our Sandbox at https://sandbox.dspace.org. So, it doesn't appear to be caused by this PR. But, is this something you think we should fix also in this PR, or should I create a new ticket?

Overall, I'm +1 this PR. Just wanted to point out this semi-related issue.

@FrancescoMolinaro
Copy link
Copy Markdown
Contributor Author

Hi @tdonohue , thanks for the feedback!
I gave a look into the filter issue and I think I found a solution, the problem seemed to be caused by an event firing only once and a couple of wrong condition in the template.
I think it make sense to keep the fix in this ticket.

I will look forward to your feedback and thanks again!

@tdonohue tdonohue self-requested a review April 24, 2025 19:33
@tdonohue tdonohue added the port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release label Apr 24, 2025
@tdonohue
Copy link
Copy Markdown
Member

tdonohue commented Apr 24, 2025

I've discovered today that this same bug appears to impact 8.x as well (it's reproducible on demo.dspace.org). So, I've updated this PR with a port to dspace-8_x label (though I suspect a manual port will be necessary). I'll be retesting this today as well.

UPDATE: The code modified in this PR also looks to exist in 7.x, so I wouldn't be surprised if this also needs to be ported to 7.x. I haven't verified the bug there yet though.

@tdonohue tdonohue added this to the 9.0 milestone Apr 24, 2025
@tdonohue tdonohue added the port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release label Apr 24, 2025
Copy link
Copy Markdown
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 @FrancescoMolinaro ! I've tested this today and found this fixes both issues now. It fixes #4205, and it also fixes the issue with the sidebar filters not loading (which I previously reported).

Today I also discovered this same issue appears to impact 8.x (both #4205 and the sidebar facets issue are reproducible on demo.dspace.org), and the code looks similar in 7.x (but I haven't been able to test the behavior there yet).

@github-project-automation github-project-automation Bot moved this from 🙋 Needs Reviewers Assigned to 👍 Reviewer Approved in DSpace 9.0 Release Apr 24, 2025
@tdonohue tdonohue merged commit b1f0ed2 into DSpace:main Apr 24, 2025
15 checks passed
@github-project-automation github-project-automation Bot moved this from 👍 Reviewer Approved to ✅ Done in DSpace 9.0 Release Apr 24, 2025
@dspace-bot
Copy link
Copy Markdown
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-4234-to-dspace-7_x origin/dspace-7_x
cd .worktree/backport-4234-to-dspace-7_x
git switch --create backport-4234-to-dspace-7_x
git cherry-pick -x e84af6ab916969442931ba4f0e0ad200008adda7 1b112dd887953946c60049d2282d1c1630666b4c 7998d2d8b98ae0fc1966111f08117a1dbf0fe056

@dspace-bot
Copy link
Copy Markdown
Contributor

Successfully created backport PR for dspace-8_x:

@tdonohue
Copy link
Copy Markdown
Member

While I added the port to dspace-7_x label on this PR, I have not yet verified this bug exists in 7.x. It's just that the code looks very similar in 7.x, so I suspect it may also need backporting to 7.x. For now, it has been backported to 8.x only.

@tdonohue tdonohue removed the port to dspace-8_x This PR needs to be ported to `dspace-8_x` branch for next bug-fix release label May 27, 2025
@FrancescoMolinaro
Copy link
Copy Markdown
Contributor Author

Hi @tdonohue , I have checked the code on 7_x and tested the issue, I believe we don't need the backporting as on the 7_x the issue is not presente and we already have the same logic to invalidate the cache: e7302bd#diff-07b76fe42cd0fdd107c20bc0af8c1337a902a4e556f3067872c1e58f8816f719R77 .

@tdonohue
Copy link
Copy Markdown
Member

tdonohue commented Jun 9, 2025

@FrancescoMolinaro : Thanks for double checking and verifying this issue isn't reproducible in 7.x. In that case, I'll remove the port to dspace-7_x label. This will only be fixed in 8.2 and 9.0

@tdonohue tdonohue removed the port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release label Jun 9, 2025
4science-it pushed a commit to 4Science/dspace-angular that referenced this pull request Mar 24, 2026
[DSC-2716] show markdown info panel in cms metadata edit

Approved-by: Francesco Molinaro
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: workflow

Projects

No open projects
Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

Inconsistency in "Workflow tasks" view after switching discovery configuration

3 participants