Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reset selected filters after search #5033

Open
wants to merge 8 commits into
base: development
Choose a base branch
from
13 changes: 12 additions & 1 deletion src/renderer/components/ft-radio-button/ft-radio-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,30 @@ export default defineComponent({
disabled: {
type: Boolean,
default: false
},
selected: {
type: String,
default: ''
}
},
emits: ['change'],
data: function () {
return {
id: '',
selectedValue: ''
}
},
computed: {
inputName: function () {
const name = this.title.replace(' ', '')
return name.toLowerCase() + this.id
},
selectedValue: {
get: function () {
return this.selected || this.values[0]
},
set: function (value) {
this.$emit('change', value)
}
}
},
mounted: function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
:title="$t('Search Filters.Sort By.Sort By')"
:labels="sortByLabels"
:values="sortByValues"
:selected="searchSettings.sortBy"
class="searchRadio"
@change="updateSortBy"
/>
Expand All @@ -18,6 +19,7 @@
:title="$t('Search Filters.Time.Time')"
:labels="timeLabels"
:values="timeValues"
:selected="searchSettings.time"
class="searchRadio"
@change="updateTime"
/>
Expand All @@ -26,6 +28,7 @@
:title="$t('Search Filters.Type.Type')"
:labels="typeLabels"
:values="typeValues"
:selected="searchSettings.type"
class="searchRadio"
@change="updateType"
/>
Expand All @@ -34,6 +37,7 @@
:title="$t('Search Filters.Duration.Duration')"
:labels="durationLabels"
:values="durationValues"
:selected="searchSettings.duration"
ankitchauhan-aka marked this conversation as resolved.
Show resolved Hide resolved
class="searchRadio"
@change="updateDuration"
/>
Expand Down
6 changes: 6 additions & 0 deletions src/renderer/components/top-nav/top-nav.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ export default defineComponent({

clearLocalSearchSuggestionsSession()

// Reset search filters if searching another query
if (this.$route.params.query && this.$route.params.query !== query) {
this.$store.commit('setSearchSettingsToDefault')
this.searchFilterValueChanged = false
ankitchauhan-aka marked this conversation as resolved.
Show resolved Hide resolved
}

this.getYoutubeUrlInfo(query).then((result) => {
switch (result.urlType) {
case 'video': {
Expand Down
9 changes: 9 additions & 0 deletions src/renderer/store/modules/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,15 @@ const mutations = {

setExternalPlayerCmdArguments (state, value) {
state.externalPlayerCmdArguments = value
},

setSearchSettingsToDefault (state) {
state.searchSettings = {
sortBy: 'relevance',
time: '',
type: 'all',
duration: ''
}
}
}

Expand Down
Loading