Skip to content

Refactor frequent items into vuex modules

Paul Slaughter requested to merge 301143-refactor-frequent-items-store into master

What does this MR do?

Currently the "Projects" and "Groups" dropdown each create their own Vue application with their own Vuex store. This will be problematic in the top nav redesign, since we'll have just 1 Vue application.

This MR refactors the "Projects" and "Groups" frequent items dropdown to work with just 1 Vuex store by moving the existing Vuex store options to a new namespaced Vuex module. This will enable us to reuse these same components in the upcoming single top nav Vue app. But, this creates 2 problems:

  1. How do we tell the components in the frequent_items component tree which Vuex module to use?
  2. The helpers like mapState only accept a hardcoded namespace.

To address problem 1, we create a new helper component called vuex_module_provider. This takes a vuexModule prop and passes it along to provide so that other components can inject: ['vuexModule'].

To address problem 2, we create a new helper module calls vuex_module_mappers which allows us to give a function in the first argument to select the namespace from the component.

Screenshots (strongly suggested)

Everything still works 🎉

Projects dropdown Group dropdown with search
Screen_Shot_2021-05-04_at_1.48.47_AM Screen_Shot_2021-05-04_at_1.49.15_AM

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

References

Related to #301143 (closed)

Edited by Paul Slaughter

Merge request reports

Loading