Skip to content

Commit

Permalink
fix: gitalk loading state not closed when recent comments are loaded
Browse files Browse the repository at this point in the history
resolved: #290 #280
  • Loading branch information
bennyxguo committed Aug 12, 2023
1 parent 909c191 commit 0595413
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 19 deletions.
4 changes: 1 addition & 3 deletions src/components/Sidebar/src/RecentComment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,7 @@ export default defineComponent({
return {
SvgTypes,
isLoading: computed(() => commentPluginLoading.value),
comments: computed(() => {
return recentComments.value
}),
comments: computed(() => recentComments.value),
isConfigReady: computed(() => appStore.configReady),
fetchRecentComment,
enabledCommentPlugin,
Expand Down
25 changes: 9 additions & 16 deletions src/hooks/useCommentPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export default function useCommentPlugin() {
/**
* Fetching recent comments data base on comment plugin
*/
const fetchRecentComment = () => {
const fetchRecentComment = async () => {
const enabledPlugin = computed<string | undefined>(() => {
const result = enabledCommentPlugin.value
return result.plugin !== '' && !!result.recentComment
Expand All @@ -109,9 +109,8 @@ export default function useCommentPlugin() {
admin: appStore.themeConfig.plugins.gitalk.admin[0]
})

githubComments.getComments().then(response => {
recentComments.value = response
})
recentComments.value = await githubComments.getComments()
commentPluginLoading.value = false

break

Expand All @@ -124,10 +123,8 @@ export default function useCommentPlugin() {
lang: appStore.themeConfig.plugins.valine.lang
})

leadCloudComments.getRecentComments(7).then(res => {
recentComments.value = res
commentPluginLoading.value = false
})
recentComments.value = await leadCloudComments.getRecentComments(7)
commentPluginLoading.value = false

break

Expand All @@ -137,10 +134,8 @@ export default function useCommentPlugin() {
lang: appStore.themeConfig.plugins.twikoo.lang
})

twikooComments.getRecentComments(7).then(res => {
recentComments.value = res
commentPluginLoading.value = false
})
recentComments.value = await twikooComments.getRecentComments(7)
commentPluginLoading.value = false

break

Expand All @@ -150,10 +145,8 @@ export default function useCommentPlugin() {
lang: appStore.locale ?? 'en'
})

walineComments.getRecentComments(7).then(res => {
recentComments.value = res
commentPluginLoading.value = false
})
recentComments.value = await walineComments.getRecentComments(7)
commentPluginLoading.value = false

break

Expand Down

0 comments on commit 0595413

Please sign in to comment.