AllenNeuralDynamics / aind-metadata-entry-js

Metadata entry using javascript
https://metadata-entry.allenneuraldynamics.org
MIT License
1 stars 1 forks source link

Unable to use existing form to fill in data #108

Closed jtyoung84 closed 6 months ago

jtyoung84 commented 11 months ago

Describe the bug When a json form is used to fill out pre-existing data, the app complains about optional fields

To Reproduce Steps to reproduce the behavior:

  1. Create a basic form with an optional field as null
  2. Try to use it to fill in a form
  3. Make a change and hit submit
  4. Notice errors about data in pre-existing fields

Expected behavior The form should submit correctly

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Most likely, this is due to the fact that optional fields listed as null have the null types input into fields that are expecting string types, etc. We can probably fix this by filtering nulls when using pre-existing data.

helen-m-lin commented 6 months ago

Please note the "optional field errors" described in the original report issue could not be reproduced (likely resolved by other recent fixes), but there were other multiple issues causing the "Autofill" feature to not work correctly:

  1. Unhandled errors for file upload
    • E.g. when an invalid file is uploaded
    • E.g. when contents cannot be read as JSON
    • E.g. when user cancels the upload
  2. Uploaded file's schema version and type were not validated
    • E.g. when schema version cannot be found
    • E.g. when schema A with version 0.1.1 is uploaded to schema B where B also has a valid 0.1.1 version
  3. Form data manually set from autofill was persisted even after a new schema is selected
  4. Button stuck in focus after click/upload, no indication that data has been auto-filled.

These issues are addressed in PR #154