Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
fix: rest session not updating when the request is renamed from the sidebar (fixes #2297)
Andrew Bastindf55807fa42c
diff --git a/packages/hoppscotch-app/components/collections/index.vue b/packages/hoppscotch-app/components/collections/index.vueindex 8034da5fe..c842ce96e 100644--- a/packages/hoppscotch-app/components/collections/index.vue+++ b/packages/hoppscotch-app/components/collections/index.vue@@ -232,7 +232,11 @@ import {editRESTRequest,saveRESTRequestAs,} from "~/newstore/collections"-import { setRESTRequest, getRESTRequest } from "~/newstore/RESTSession"+import {+ setRESTRequest,+ getRESTRequest,+ getRESTSaveContext,+} from "~/newstore/RESTSession"import {useReadonlyStream,useStreamSubscriber,@@ -495,12 +499,27 @@ export default defineComponent({},// Intented to by called by CollectionsEditRequest modal submit eventupdateEditingRequest(requestUpdateData) {+ const saveCtx = getRESTSaveContext()+const requestUpdated = {...this.editingRequest,name: requestUpdateData.name || this.editingRequest.name,}if (this.collectionsType.type === "my-collections") {+ // Update REST Session with the updated state+ if (+ saveCtx &&+ saveCtx.originLocation === "user-collection" &&+ saveCtx.requestIndex === this.editingRequestIndex &&+ saveCtx.folderPath === this.editingFolderPath+ ) {+ setRESTRequest({+ ...getRESTRequest(),+ name: requestUpdateData.name,+ })+ }+editRESTRequest(this.editingFolderPath,this.editingRequestIndex,@@ -515,6 +534,18 @@ export default defineComponent({const requestName = requestUpdateData.name || this.editingRequest.name+ // Update REST Session with the updated state+ if (+ saveCtx &&+ saveCtx.originLocation === "team-collection" &&+ saveCtx.requestID === this.editingRequestIndex+ ) {+ setRESTRequest({+ ...getRESTRequest(),+ name: requestUpdateData.name,+ })+ }+runMutation(UpdateRequestDocument, {data: {request: JSON.stringify(requestUpdated),