Molecular-Biophysics-Database / mbdb-input-ui

Prototype implementation of the input forms
Other
0 stars 0 forks source link

Load all vocabularies before the form is initialized #42

Open MadCatX opened 1 year ago

MadCatX commented 1 year ago

Vocabularies are now loaded lazily only when they are actually required. Vocabularies also need to be available in functions that check initial form data, otherwise it is not possible to verify that the initial value for a vocabulary item is sensible. Getting a vocabulary requires a network fetch, which is an async operation. To make this work correctly, all of the import validation code would have to be async as well, which is unfeasible.

The solution is to preload all vocabularies in advance and read them synchronously from a local cache.