Skip to content

Item action button disabled after redirect from action page #1695

@ybnd

Description

@ybnd

Describe the bug
After withdrawing/reinstating an Item and getting redirected back to /edit/status, the reinstate/withdraw button is disabled.

To Reproduce

  1. Log in as an admin
  2. Edit any archived Item
  3. Click "Withdraw" and confirm
    • You will be redirected back to /edit/status
    • The "Reinstate" button will be disabled
  4. Refresh
    • The "Reinstate" button will no longer be disabled
  5. Click "Reinstate" and confirm
    • You will be redirected back to /edit/status
    • The "Withdraw" button will be disabled
  6. Refresh
    • The "Withdraw" button will no longer be disabled

Expected behavior
The buttons should not be disabled after the initial redirect.

Underlying issue
This happens because the Item's authorization features are taken from the cache after the redirect; if the action changes them this does not get reflected on the status page.
Currently this is only noticeable for withdrawItem & reinstateItem.

@artlowel suggested this should be solved more generally:

  • When a cached DSO is invalidated via DataService.invalidate(), cached authorizations related to it should be invalidated as well
  • We'd need to have a way of retrieving the related authorizations, for example by keeping an index of UUID → authorization.
    Even more generally, we may want to index resources that depend on other resources; DSO → authorization would be a specific case of this.
  • Once something like the above is in place, the bug can be solved by adding an invalidate(item) call to ItemDataService.setWithDrawn and similar methods

Related work
#1608

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions