From a9a3087b198a471b67236ac68fe135eb970e28fc Mon Sep 17 00:00:00 2001 From: amansinghbais Date: Mon, 15 Jul 2024 11:34:18 +0530 Subject: [PATCH] Improved: clearing gitbook search modal queries on modal dismiss and promise for fetching resources (#313) --- src/components/DxpGitBookSearch.vue | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/components/DxpGitBookSearch.vue b/src/components/DxpGitBookSearch.vue index 80ad901..f278f97 100644 --- a/src/components/DxpGitBookSearch.vue +++ b/src/components/DxpGitBookSearch.vue @@ -5,7 +5,7 @@ - + @@ -230,7 +230,7 @@ async function fetchSources() { isResourceLoading.value = true; const list = [] as any; - const responses = await Promise.all(answer.value.sources.map((source: any) => { + const responses = await (Promise as any).allSettled(answer.value.sources.map((source: any) => { if(source.type === "page") { return gitBookContext.getGitBookPage({ pageId: source.page, @@ -260,4 +260,17 @@ function searchRelatedQuestion(question: string) { queryString.value = question; askQuery() } + +function clearQueryState() { + selectedSegment.value = "search"; + queryString.value = ""; + searchedItems.value = []; + answer.value = {}; + + isLoading.value = false; + + isResourceLoading.value = false; + sources.value = []; + isResourceFetched.value = false; +} \ No newline at end of file