From a8cfe96f60cee9a5e78ae53c0d6fecef21ebccc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Fri, 9 Aug 2019 17:10:43 +0200 Subject: [PATCH] Don't chane the filterPostsMenu with state @mattwr18 state is the root of all evil --- webapp/layouts/default.vue | 5 ++++- webapp/pages/index.spec.js | 4 ---- webapp/pages/index.vue | 5 ----- webapp/store/default.js | 17 ----------------- 4 files changed, 4 insertions(+), 27 deletions(-) delete mode 100644 webapp/store/default.js diff --git a/webapp/layouts/default.vue b/webapp/layouts/default.vue index 28b198a79..27aab058a 100644 --- a/webapp/layouts/default.vue +++ b/webapp/layouts/default.vue @@ -183,7 +183,6 @@ export default { isAdmin: 'auth/isAdmin', quickSearchResults: 'search/quickResults', quickSearchPending: 'search/quickPending', - showFilterPostsDropdown: 'default/showFilterPostsDropdown', usersFollowedFilter: 'posts/usersFollowedFilter', categoriesFilter: 'posts/categoriesFilter', }), @@ -223,6 +222,10 @@ export default { } return routes }, + showFilterPostsDropdown() { + const [firstRoute] = this.$route.matched + return firstRoute.name === 'index' + }, }, watch: { Category(category) { diff --git a/webapp/pages/index.spec.js b/webapp/pages/index.spec.js index 920757d01..fc2555411 100644 --- a/webapp/pages/index.spec.js +++ b/webapp/pages/index.spec.js @@ -5,7 +5,6 @@ import Styleguide from '@human-connection/styleguide' import Filters from '~/plugins/vue-filters' import VTooltip from 'v-tooltip' import FilterMenu from '~/components/FilterMenu/FilterMenu' -import { mutations } from '~/store/default' const localVue = createLocalVue() @@ -44,9 +43,6 @@ describe('PostIndex', () => { 'posts/usersFollowedFilter': () => {}, 'posts/categoriesFilter': () => {}, }, - mutations: { - 'default/SET_SHOW_FILTER_POSTS_DROPDOWN': mutations.SET_SHOW_FILTER_POSTS_DROPDOWN, - }, }) mocks = { $t: key => key, diff --git a/webapp/pages/index.vue b/webapp/pages/index.vue index e917433c8..c85354d73 100644 --- a/webapp/pages/index.vue +++ b/webapp/pages/index.vue @@ -92,14 +92,10 @@ export default { } }, mounted() { - this.toggleShowFilterPostsDropdown(true) if (this.hashtag) { this.changeFilterBubble({ tags_some: { name: this.hashtag } }) } }, - beforeDestroy() { - this.toggleShowFilterPostsDropdown(false) - }, watch: { Post(post) { this.setPosts(this.Post) @@ -122,7 +118,6 @@ export default { methods: { ...mapMutations({ setPosts: 'posts/SET_POSTS', - toggleShowFilterPostsDropdown: 'default/SET_SHOW_FILTER_POSTS_DROPDOWN', }), changeFilterBubble(filter) { if (this.hashtag) { diff --git a/webapp/store/default.js b/webapp/store/default.js deleted file mode 100644 index 7af564910..000000000 --- a/webapp/store/default.js +++ /dev/null @@ -1,17 +0,0 @@ -export const state = () => { - return { - showFilterPostsDropdown: false, - } -} - -export const getters = { - showFilterPostsDropdown(state) { - return state.showFilterPostsDropdown || false - }, -} - -export const mutations = { - SET_SHOW_FILTER_POSTS_DROPDOWN(state, boolean) { - state.showFilterPostsDropdown = boolean || null - }, -}