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

MetacatUI Editor Save Button Stuck on "Submitting ..." with TypeError in Console #2606

Open
vchendrix opened this issue Feb 3, 2025 · 1 comment · May be fixed by #2609
Open

MetacatUI Editor Save Button Stuck on "Submitting ..." with TypeError in Console #2606

vchendrix opened this issue Feb 3, 2025 · 1 comment · May be fixed by #2609
Labels

Comments

@vchendrix
Copy link
Collaborator

Describe the bug

When trying to save files in the MetacatUI Editor, the save button gets stuck on "Submitting ...". The browser console shows a TypeError.

To Reproduce

Steps to reproduce the behavior:

  1. Go to the MetacatUI Editor.
  2. Add some files.
  3. Click the save button.
  4. See the error.

Expected behavior

The files should be saved without errors, and the success message should show at the top of the page

Screenshots

Here is a look at the page stuck in "Submitting .."

Image

Here is the line of code that errors

Image

Desktop (please complete the following information):

  • OS: MacOS Sequioia
  • Browser: Chrome
  • Version: 2.32.0

Additional context

  • Tested on: local versions of articdata.io test server as well as data-dev.ess-dive.bl.gov
  • JavaScript console error:
    EML211EditorView.js?v=2.32.0:1231 Uncaught TypeError: errors?.forEach is not a function
    at n.showValidation (EML211EditorView.js?v=2.32.0:1231:17)
    at _ (backbone.js:371:57)
    at m (backbone.js:356:19)
    at f (backbone.js:155:16)
    at u.trigger (backbone.js:346:5)
    at n._validate (backbone.js:728:12)
    at n.isValid (backbone.js:718:19)
    at DataPackage.js?v=2.32.0:1438:19
    at m.every.m.all (underscore.js:245:12)
    at n.save (DataPackage.js?v=2.32.0:1437:30)
    
@vchendrix vchendrix added the bug label Feb 3, 2025
@vchendrix
Copy link
Collaborator Author

The error TypeError: errors?.forEach is not a function indicates that the errors variable is not an array, and hence the forEach method is not available.

To handle the errors dictionary instead of expecting an array, you can modify the showValidation method to iterate over the dictionary entries. This change would be to use Object.entries to iterate over the errors dictionary and process each error message accordingly.

vchendrix added a commit to wfsi-data/metacatui that referenced this issue Feb 5, 2025
- Addressed issue in `EML211EditorView.showValidation` to correctly display nested validation errors.
- Enhanced `EML211.validate` to handle annotation validation more robustly, preventing null errors.
- Added unit tests to cover the changes in `EML211EditorView.showValidation`.

Fixes NCEAS#2606
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant