<commit_before>import { buildFilterProductsQuery } from '@vue-storefront/core/helpers'
import { mapGetters } from 'vuex'
import pickBy from 'lodash-es/pickBy'

export default {
  name: 'CategorySidebar',
  props: {
    filters: {
      type: Object,
      required: true
    }
  },
  computed: {
    ...mapGetters('category', ['getCurrentCategory', 'getActiveCategoryFilters', 'getCurrentCategoryProductQuery']),
    category () {
      return this.getCurrentCategory
    },
    activeFilters () {
      return this.getActiveCategoryFilters
    },
    availableFilters () {
      return pickBy(this.filters, (filter) => { return (filter.length) })
    },
    hasActiveFilters () {
      return Object.keys(this.activeFilters).length !== 0
    }
  },
  methods: {
    sortById (filters) {
      return [...filters].sort((a, b) => { return a.id - b.id })
    },
    resetAllFilters () {
      this.$bus.$emit('filter-reset')
      this.$store.dispatch('category/resetFilters')
      this.$store.dispatch('category/searchProductQuery', {})
      this.$store.dispatch('category/mergeSearchOptions', {
        searchProductQuery: buildFilterProductsQuery(this.category, this.activeFilters)
      })
      this.$store.dispatch('category/products', this.getCurrentCategoryProductQuery)
    }
  }
}<commit_msg>reset filters on category sidemenu load<commit_after>import { buildFilterProductsQuery } from '@vue-storefront/core/helpers'
import { mapGetters } from 'vuex'
import pickBy from 'lodash-es/pickBy'

export default {
  name: 'CategorySidebar',
  props: {
    filters: {
      type: Object,
      required: true
    }
  },
  computed: {
    ...mapGetters('category', ['getCurrentCategory', 'getActiveCategoryFilters', 'getCurrentCategoryProductQuery']),
    category () {
      return this.getCurrentCategory
    },
    activeFilters () {
      return this.getActiveCategoryFilters
    },
    availableFilters () {
      return pickBy(this.filters, (filter) => { return (filter.length) })
    },
    hasActiveFilters () {
      return Object.keys(this.activeFilters).length !== 0
    }
  },
  mounted () {
    this.resetAllFilters()
  },
  methods: {
    sortById (filters) {
      return [...filters].sort((a, b) => { return a.id - b.id })
    },
    resetAllFilters () {
      this.$bus.$emit('filter-reset')
      this.$store.dispatch('category/resetFilters')
      this.$store.dispatch('category/searchProductQuery', {})
      this.$store.dispatch('category/mergeSearchOptions', {
        searchProductQuery: buildFilterProductsQuery(this.category, this.activeFilters)
      })
      this.$store.dispatch('category/products', this.getCurrentCategoryProductQuery)
    }
  }
}
{'fraction_non_alphanumeric': 0.14120283899887934, 'fraction_numerical': 0.0007471049682480389, 'mean_word_length': 3.2643312101910826, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6983920', 'n_tokens_mistral': 766, 'n_tokens_neox': 791, 'n_words': 131}