psychoinformatics-de / shacl-vue

https://psychoinformatics-de.github.io/shacl-vue/
MIT License
0 stars 0 forks source link

Investigate vue3 `suspense` for async dependencies of a component #12

Open jsheunis opened 1 month ago

jsheunis commented 1 month ago

https://vuejs.org/guide/built-ins/suspense.html

This surfaced because of an error I got for a component variable which was initialized as ref(null) and which is the binding variable for the items of a v-select component, i.e. it should be an iterable:

[Vue warn]: Unhandled error during execution of render function 
  at <VSelect items=null item-title="name" label="Select a Node"  ... > 

and further on:

Uncaught TypeError: items is not iterable

which lead me to this explanation: https://stackoverflow.com/a/65843026

This particular case can be solved easily by initializing the variable as ref([]), but the use of suspense can possibly be used in many cases where previously I have used, for example, v-if="dataset_ready" which will show a component only once custom logic has set the dataset_ready variable to true.