Browse Source

fix: reference sharing when requests are opened from the sidebar

Andrew Bastin 2 years ago
parent
commit
c99b224829
1 changed files with 8 additions and 5 deletions
  1. 8 5
      packages/hoppscotch-app/components/collections/my/Request.vue

+ 8 - 5
packages/hoppscotch-app/components/collections/my/Request.vue

@@ -165,6 +165,7 @@ import {
   isEqualHoppRESTRequest,
 } from "@hoppscotch/data"
 import * as E from "fp-ts/Either"
+import cloneDeep from "lodash/cloneDeep"
 import {
   useI18n,
   useToast,
@@ -317,15 +318,17 @@ const getRequestLabelColor = (method: string) =>
 
 const setRestReq = (request: any) => {
   setRESTRequest(
-    safelyExtractRESTRequest(
-      translateToNewRequest(request),
-      getDefaultRESTRequest()
+    cloneDeep(
+      safelyExtractRESTRequest(
+        translateToNewRequest(request),
+        getDefaultRESTRequest()
+      )
     ),
     {
       originLocation: "user-collection",
       folderPath: props.folderPath,
       requestIndex: props.requestIndex,
-      req: request,
+      req: cloneDeep(request),
     }
   )
 }
@@ -397,7 +400,7 @@ const discardRequestChange = () => {
       originLocation: "user-collection",
       folderPath: props.folderPath,
       requestIndex: props.requestIndex,
-      req: props.request,
+      req: cloneDeep(props.request),
     })
   }