Skip to content

Split metadata from the elements Vuex module into a Pinia store

To make migrating the elements module to Pinia easier (#1142 (closed)), and then get more maintainable Pinia stores, we need to split it into multiple stores. The elements module does not need to handle metadata. We can move those to a new metadata Pinia store.

Metadata are currently managed by updating an element's metadata attribute directly. We will need to change this; the new store's state will include metadata: { [elementId]: Metadata[] } instead.

This will remove the following from the elements module:

  • The setMetadata mutation
  • The addMetadata mutation
  • The updateMetadata mutation
  • The removeMetadata mutation
  • The createMetadata action
  • The updateMetadata action
  • The deleteMetadata action
  • The listMetadata action
  • The setInArray helper

If this and classifications are both moved away from the elements module, then the createInArray, updateInArray and removeFromArray helpers should also be removed.

The element list APIs may return a metadata attribute when with_metadata is set, but we don't use this at all in the frontend. The other element APIs are not returning metadata, so the elements Vuex module should not need to be calling this new Pinia store.