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

Fix caching issues for versioning #2761

Merged
merged 8 commits into from
May 30, 2024
Merged

Conversation

ybnd
Copy link
Member

@ybnd ybnd commented Jan 22, 2024

References

Add references/links to any related issues or PRs. These may include:

Description

This PR improves the usability of versioning on Item pages by ensuring that

  • the "create new version" enabled/disabled status of the button stays in sync with the "draft status" of the Item's version history
  • the workflow/workspace labels in the versions table

Reviewing

Confirm that the original issue can no longer be replicated

  1. Log in as an administrator
  2. Submit an Item into a Collection with workflow enabled
  3. Create a new version and click "save for later" in the submission form
  4. Go to the Item page, avoiding a full reload
    • The "new version" button should be disabled
    • The version table should list the new version with a "workspace" label
  5. Open the in-progress submission again and deposit it
  6. Go to the Item page, avoiding a full reload
    • The "new version" button should be disabled
    • The version table should list the new version with a "workflow" label
  7. Go to MyDSpace, claim the task and accept it through to the end of the workflow
  8. Go to the Item page, avoiding a full reload
    • The "new version" button should be enabled
    • The version table should list the new version as an archived Item

Future work

Both of the above issues were fixed by introducing cache invalidation where it was missing.

Note that it may be useful to consider doing more in-depth refactoring to make cache invalidation more robust:

  • Currently, submission REST requests are sent using a repeated custom pattern instead of a "real" data service
    • Many other services and methods are implemented in a similar way
  • Previously, we have introduced cache invalidation for all data service PATCH requests
    • With this kind of approach we can handle cache invalidation issues at a lower level, instead of within the affected services and components

Checklist

This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!

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

@ybnd ybnd added component: versioning performance / caching Related to performance, caching or embedded objects component: Item (Archived) Item display or editing labels Jan 22, 2024
@ybnd ybnd force-pushed the fix-versioning-button branch 2 times, most recently from 7295025 to 48b1458 Compare February 7, 2024 09:54
Copy link

Hi @ybnd,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

@ybnd ybnd marked this pull request as ready for review March 1, 2024 11:19
@tdonohue tdonohue added port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release bug labels Mar 1, 2024
Copy link

github-actions bot commented Mar 4, 2024

Hi @ybnd,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

Copy link

github-actions bot commented Mar 8, 2024

Hi @ybnd,
Conflicts have been detected against the base branch.
Please resolve these conflicts as soon as you can. Thanks!

@tdonohue
Copy link
Member

@ybnd : I tested this today, and while I can create a version... I never get to the submission form. So, I'm seeing the behavior described in #2923. It's possible this PR does fix the bug you describe, but I'm not yet able to test it because of #2923. If you have any ideas regarding what might be happening in #2923, please feel free to let me know or add a fix to this PR.

(There's a separate, similar bug also in #2924... but, I believe that's being worked on by @atarix83 / 4Science. I'm just trying to figure out how to get Item Versioning working again.)

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 @ybnd ! I was able to finally test this today. I've verified the bug exists and that this appears to fix it. I haven't found any side effects.

@tdonohue tdonohue merged commit 123b6b7 into DSpace:main May 30, 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-2761-to-dspace-7_x origin/dspace-7_x
cd .worktree/backport-2761-to-dspace-7_x
git switch --create backport-2761-to-dspace-7_x
git cherry-pick -x 9960b93f5815d0f5c0a1cc79f87ab5fb409eb1e3 9f39358efbfadb8b89e5220b1d705b76d120667e adb2e31026797eec7161b90eaff15dfe3ea6bfa6

@tdonohue tdonohue added this to the 8.0 milestone May 30, 2024
@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 May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug component: Item (Archived) Item display or editing component: versioning performance / caching Related to performance, caching or embedded objects
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Create new version button disabled when no new version in progress
3 participants