Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

fix: collection request name edit issue (#3115)

Anwarul Islam2db567589fb9
diff --git a/packages/hoppscotch-common/src/components/collections/index.vue b/packages/hoppscotch-common/src/components/collections/index.vue
index 84cdb1eb5..269c3c5ac 100644
--- a/packages/hoppscotch-common/src/components/collections/index.vue
+++ b/packages/hoppscotch-common/src/components/collections/index.vue
@@ -125,8 +125,8 @@
@hide-modal="displayModalEditFolder(false)"
/>
<CollectionsEditRequest
+ v-model="editingRequestName"
:show="showModalEditRequest"
- :model-value="editingRequest ? editingRequest.name : ''"
:loading-state="modalLoadingState"
@submit="updateEditingRequest"
@hide-modal="displayModalEditRequest(false)"
@@ -157,7 +157,7 @@
</template>
<script setup lang="ts">
-import { computed, PropType, ref, watch } from "vue"
+import { computed, nextTick, PropType, ref, watch } from "vue"
import { useToast } from "@composables/toast"
import { useI18n } from "@composables/i18n"
import { Picked } from "~/helpers/types/HoppPicked"
@@ -288,6 +288,7 @@ const editingFolder = ref<
const editingFolderName = ref<string | null>(null)
const editingFolderPath = ref<string | null>(null)
const editingRequest = ref<HoppRESTRequest | null>(null)
+const editingRequestName = ref("")
const editingRequestIndex = ref<number | null>(null)
const editingRequestID = ref<string | null>(null)
@@ -860,6 +861,7 @@ const editRequest = (payload: {
}) => {
const { folderPath, requestIndex, request } = payload
editingRequest.value = request
+ editingRequestName.value = request.name ?? ""
if (collectionsType.value.type === "my-collections" && folderPath) {
editingFolderPath.value = folderPath
editingRequestIndex.value = parseInt(requestIndex)
@@ -893,6 +895,9 @@ const updateEditingRequest = (newName: string) => {
if (possibleActiveTab) {
possibleActiveTab.value.document.request.name = requestUpdated.name
+ nextTick(() => {
+ possibleActiveTab.value.document.isDirty = false
+ })
}
displayModalEditRequest(false)
@@ -931,6 +936,9 @@ const updateEditingRequest = (newName: string) => {
if (possibleTab) {
possibleTab.value.document.request.name = requestName
+ nextTick(() => {
+ possibleTab.value.document.isDirty = false
+ })
}
}
}
diff --git a/packages/hoppscotch-common/src/components/http/Request.vue b/packages/hoppscotch-common/src/components/http/Request.vue
index 079d0c86a..10aa7a205 100644
--- a/packages/hoppscotch-common/src/components/http/Request.vue
+++ b/packages/hoppscotch-common/src/components/http/Request.vue
@@ -217,6 +217,7 @@
@hide-modal="showCodegenModal = false"
/>
<CollectionsSaveRequest
+ v-if="showSaveRequestModal"
mode="rest"
:show="showSaveRequestModal"
@hide-modal="showSaveRequestModal = false"
diff --git a/packages/hoppscotch-common/src/pages/index.vue b/packages/hoppscotch-common/src/pages/index.vue
index a84792ed5..f964da1be 100644
--- a/packages/hoppscotch-common/src/pages/index.vue
+++ b/packages/hoppscotch-common/src/pages/index.vue
@@ -79,8 +79,9 @@
@resolve="onResolveConfirmSaveTab"
/>
<CollectionsSaveRequest
+ v-if="savingRequest"
+ mode="rest"
:show="savingRequest"
- :mode="'rest'"
@hide-modal="onSaveModalClose"
/>
</div>