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

(UI) Publish buttons: refactored isDisabled function #1808

Conversation

alejandromumo
Copy link
Member

Issue

On Zenodo, we have seen multiple inclusion requests being created for records that have "Pending" files. When the receiver tries to accept the request - and publish the record - it fails and does not show any useful information for the user.

How to replicate

  1. Create a draft
  2. Fill in the required metadata
  3. Select a community
  4. Add a file but don't let it finish (e.g. use network throttling or simply reload the page)
  5. Validate that the button "Submit" is enabled

Changes

  • Refactored isDisabled function in PublishButton and SubmitReviewButton components to check if all files are finished uploading before enabling the button.
  • Passed filesState instead of just the number of files to the function.
  • Added a check for non-finished files.
  • Added early returns to avoid unnecessary checks on possible large objects / arrays.

* Refactored isDisabled function in PublishButton and SubmitReviewButton components to check if all files are finished uploading before enabling the button.
* Passed filesState instead of just the number of files to the function.
* Added a check for non-finished files.
* Added early returns to avoid unnecessary checks on possible large objects / arrays.
@alejandromumo alejandromumo changed the title controls: refactored isDisabled function (UI) Publish buttons: refactored isDisabled function Sep 3, 2024
Copy link
Contributor

@jrcastro2 jrcastro2 left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@alejandromumo
Copy link
Member Author

Created an issue for the backend: #1809

@alejandromumo alejandromumo merged commit 7e66add into inveniosoftware:master Sep 3, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants