Skip to content

Commit

Permalink
$ Change code style
Browse files Browse the repository at this point in the history
  • Loading branch information
PikachuEXE committed Nov 28, 2024
1 parent 6041e3a commit 82c92d3
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 33 deletions.
2 changes: 1 addition & 1 deletion src/renderer/components/ChannelDetails/ChannelDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@
v-if="showSearchBar"
ref="searchBar"
:placeholder="$t('Channel.Search Channel')"
:value="props.query"
:value="query"
:show-clear-text-button="true"
class="channelSearch"
:maxlength="255"
Expand Down
28 changes: 16 additions & 12 deletions src/renderer/views/Channel/Channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -2039,31 +2039,35 @@ export default defineComponent({
async saveStateInRouter(query) {
this.skipRouteChangeWatcherOnce = true
if (query === '') {
await this.$router.replace({ path: `/channel/${this.id}` }).catch(failure => {
try {
await this.$router.replace({ path: `/channel/${this.id}` })
} catch (failure) {
if (isNavigationFailure(failure, NavigationFailureType.duplicated)) {
return
}

throw failure
})
}
return
}

await this.$router.replace({
path: `/channel/${this.id}`,
params: {
currentTab: 'search',
},
query: {
searchQueryText: query,
},
}).catch(failure => {
try {
await this.$router.replace({
path: `/channel/${this.id}`,
params: {
currentTab: 'search',
},
query: {
searchQueryText: query,
},
})
} catch (failure) {
if (isNavigationFailure(failure, NavigationFailureType.duplicated)) {
return
}

throw failure
})
}
this.skipRouteChangeWatcherOnce = false
},

Expand Down
2 changes: 1 addition & 1 deletion src/renderer/views/Channel/Channel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
:query="lastSearchQuery"
class="card channelDetails"
@change-tab="changeTab"
@search="(v) => newSearchWithStatePersist(v)"
@search="newSearchWithStatePersist"
@subscribed="handleSubscription"
/>
<ft-card
Expand Down
18 changes: 11 additions & 7 deletions src/renderer/views/History/History.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,15 @@ export default defineComponent({

async saveStateInRouter({ query = this.query, searchDataLimit = this.searchDataLimit, doCaseSensitiveSearch = this.doCaseSensitiveSearch } = {}) {
if (query === '') {
await this.$router.replace({ name: 'history' }).catch(failure => {
try {
await this.$router.replace({ name: 'history' })
} catch (failure) {
if (isNavigationFailure(failure, NavigationFailureType.duplicated)) {
return
}

throw failure
})
}
return
}

Expand All @@ -167,16 +169,18 @@ export default defineComponent({
searchDataLimit: searchDataLimit,
}
if (doCaseSensitiveSearch) { routerQuery.doCaseSensitiveSearch = 'true' }
await this.$router.replace({
name: 'history',
query: routerQuery,
}).catch(failure => {
try {
await this.$router.replace({
name: 'history',
query: routerQuery,
})
} catch (failure) {
if (isNavigationFailure(failure, NavigationFailureType.duplicated)) {
return
}

throw failure
})
}
},

keyboardShortcutHandler: function (event) {
Expand Down
12 changes: 7 additions & 5 deletions src/renderer/views/Playlist/Playlist.js
Original file line number Diff line number Diff line change
Expand Up @@ -624,16 +624,18 @@ export default defineComponent({
routeQuery.searchQueryText = query
}

await this.$router.replace({
path: `/playlist/${this.playlistId}`,
query: routeQuery,
}).catch(failure => {
try {
await this.$router.replace({
path: `/playlist/${this.playlistId}`,
query: routeQuery,
})
} catch (failure) {
if (isNavigationFailure(failure, NavigationFailureType.duplicated)) {
return
}

throw failure
})
}
},

getIconForSortPreference: (s) => getIconForSortPreference(s),
Expand Down
18 changes: 11 additions & 7 deletions src/renderer/views/UserPlaylists/UserPlaylists.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,15 @@ export default defineComponent({

async saveStateInRouter({ query = this.query, searchDataLimit = this.searchDataLimit, doSearchPlaylistsWithMatchingVideos = this.doSearchPlaylistsWithMatchingVideos } = {}) {
if (this.query === '') {
await this.$router.replace({ name: 'userPlaylists' }).catch(failure => {
try {
await this.$router.replace({ name: 'userPlaylists' })
} catch (failure) {
if (isNavigationFailure(failure, NavigationFailureType.duplicated)) {
return
}

throw failure
})
}
return
}

Expand All @@ -296,16 +298,18 @@ export default defineComponent({
searchDataLimit: searchDataLimit,
}
if (doSearchPlaylistsWithMatchingVideos) { routerQuery.doSearchPlaylistsWithMatchingVideos = 'true' }
await this.$router.replace({
name: 'userPlaylists',
query: routerQuery,
}).catch(failure => {
try {
await this.$router.replace({
name: 'userPlaylists',
query: routerQuery,
})
} catch (failure) {
if (isNavigationFailure(failure, NavigationFailureType.duplicated)) {
return
}

throw failure
})
}
},

keyboardShortcutHandler: function (event) {
Expand Down

0 comments on commit 82c92d3

Please sign in to comment.