fix: autocomplete bug (#3285)

Co-authored-by: Liyas Thomas <liyascthomas@gmail.com>
This commit is contained in:
Nivedin
2023-08-24 18:46:58 +05:30
committed by GitHub
parent a8e279db28
commit a9a4ebf595
3 changed files with 5 additions and 24 deletions

View File

@@ -185,7 +185,6 @@
"folder": "Folder is empty", "folder": "Folder is empty",
"headers": "This request does not have any headers", "headers": "This request does not have any headers",
"history": "History is empty", "history": "History is empty",
"history_suggestions": "History does not have any matching entries",
"invites": "Invite list is empty", "invites": "Invite list is empty",
"members": "Team is empty", "members": "Team is empty",
"parameters": "This request does not have any parameters", "parameters": "This request does not have any parameters",
@@ -195,7 +194,6 @@
"schema": "Connect to a GraphQL endpoint to view schema", "schema": "Connect to a GraphQL endpoint to view schema",
"shortcodes": "Shortcodes are empty", "shortcodes": "Shortcodes are empty",
"subscription": "Subscriptions are empty", "subscription": "Subscriptions are empty",
"suggestions": "No matching suggestions found",
"team_name": "Team name empty", "team_name": "Team name empty",
"teams": "You don't belong to any teams", "teams": "You don't belong to any teams",
"tests": "There are no tests for this request" "tests": "There are no tests for this request"

View File

@@ -56,13 +56,7 @@
:inspection-results="tabResults" :inspection-results="tabResults"
@paste="onPasteUrl($event)" @paste="onPasteUrl($event)"
@enter="newSendRequest" @enter="newSendRequest"
> />
<template #empty>
<span>
{{ t("empty.history_suggestions") }}
</span>
</template>
</SmartEnvInput>
</div> </div>
</div> </div>
<div class="flex mt-2 sm:mt-0"> <div class="flex mt-2 sm:mt-0">

View File

@@ -18,7 +18,9 @@
/> />
</div> </div>
<ul <ul
v-if="showSuggestionPopover && autoCompleteSource" v-if="
showSuggestionPopover && autoCompleteSource && suggestions.length > 0
"
ref="suggestionsMenu" ref="suggestionsMenu"
class="suggestions" class="suggestions"
> >
@@ -39,20 +41,12 @@
<span class="ml-2 truncate">to select</span> <span class="ml-2 truncate">to select</span>
</div> </div>
</li> </li>
<li v-if="suggestions.length === 0" class="pointer-events-none">
<div v-if="slots.empty" class="truncate py-0.5">
<slot name="empty"></slot>
</div>
<span v-else class="truncate py-0.5">
{{ t("empty.suggestions") }}
</span>
</li>
</ul> </ul>
</div> </div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted, watch, nextTick, computed, Ref, useSlots } from "vue" import { ref, onMounted, watch, nextTick, computed, Ref } from "vue"
import { import {
EditorView, EditorView,
placeholder as placeholderExt, placeholder as placeholderExt,
@@ -69,7 +63,6 @@ import { HoppReactiveEnvPlugin } from "~/helpers/editor/extensions/HoppEnvironme
import { useReadonlyStream } from "@composables/stream" import { useReadonlyStream } from "@composables/stream"
import { AggregateEnvironment, aggregateEnvs$ } from "~/newstore/environments" import { AggregateEnvironment, aggregateEnvs$ } from "~/newstore/environments"
import { platform } from "~/platform" import { platform } from "~/platform"
import { useI18n } from "~/composables/i18n"
import { onClickOutside, useDebounceFn } from "@vueuse/core" import { onClickOutside, useDebounceFn } from "@vueuse/core"
import { InspectorResult } from "~/services/inspection" import { InspectorResult } from "~/services/inspection"
import { invokeAction } from "~/helpers/actions" import { invokeAction } from "~/helpers/actions"
@@ -111,10 +104,6 @@ const emit = defineEmits<{
(e: "click", ev: any): void (e: "click", ev: any): void
}>() }>()
const slots = useSlots()
const t = useI18n()
const cachedValue = ref(props.modelValue) const cachedValue = ref(props.modelValue)
const view = ref<EditorView>() const view = ref<EditorView>()