diff options
Diffstat (limited to 'app/assets/javascripts/search/topbar/components/group_filter.vue')
-rw-r--r-- | app/assets/javascripts/search/topbar/components/group_filter.vue | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/app/assets/javascripts/search/topbar/components/group_filter.vue b/app/assets/javascripts/search/topbar/components/group_filter.vue index 45a6ae73fac..e5edb21792a 100644 --- a/app/assets/javascripts/search/topbar/components/group_filter.vue +++ b/app/assets/javascripts/search/topbar/components/group_filter.vue @@ -18,12 +18,18 @@ export default { }, }, computed: { - ...mapState(['groups', 'fetchingGroups']), + ...mapState(['query', 'groups', 'fetchingGroups']), ...mapGetters(['frequentGroups']), selectedGroup() { return isEmpty(this.initialData) ? ANY_OPTION : this.initialData; }, }, + created() { + // This tracks groups searched via the top nav search bar + if (this.query.nav_source === 'navbar' && this.initialData?.id) { + this.setFrequentGroup(this.initialData); + } + }, methods: { ...mapActions(['fetchGroups', 'setFrequentGroup', 'loadFrequentGroups']), handleGroupChange(group) { @@ -33,7 +39,11 @@ export default { } visitUrl( - setUrlParams({ [GROUP_DATA.queryParam]: group.id, [PROJECT_DATA.queryParam]: null }), + setUrlParams({ + [GROUP_DATA.queryParam]: group.id, + [PROJECT_DATA.queryParam]: null, + nav_source: null, + }), ); }, }, |