Separate one media
store into single media type stores and useAllMedia
store.
#587
Labels
💻 aspect: code
Concerns the software code in the repository
🧰 goal: internal improvement
Improvement that benefits maintainers, not users
🟩 priority: low
Low priority and doesn't need to be rushed
🧱 stack: frontend
Related to the Nuxt frontend
This issue description is largely based on @sarayourfriend 's comment on the
media
store Pinia conversion.Problem
Currently, we have a single large store to keep data about the media search results of all type. This means that for all actions, we have to pass
mediaType
parameter to apply changes to the correct data. The actions and getters forallMedia
are quite different from the single media type actions, and they are all bundled together in a large store.Having all our media results in a single store:
Description
If we changed the media store to be generic, something like this:
Then
useImageStore
anduseAudioStore
are separate entities. A thirduseAllResultsStore
would aggregate the two (and any future stores) in a generic fashion.This would remove all the
[mediaType]
keying we have to do now as well as the conditionals aroundALL_MEDIA
that we have to do now.The search page itself would decide which store to use based on the search type, rather than having the media store opaquely decide which results to return.
Another part of the store that keeps single media details, will also need to be split into its own store.
Implementation
The text was updated successfully, but these errors were encountered: