fix: shared references on saveRequest causing overwrite fixes #1992
This commit is contained in:
@@ -60,6 +60,7 @@
|
||||
<script setup lang="ts">
|
||||
import { reactive, ref, watch } from "@nuxtjs/composition-api"
|
||||
import { HoppGQLRequest, isHoppRESTRequest } from "@hoppscotch/data"
|
||||
import cloneDeep from "lodash/cloneDeep"
|
||||
import {
|
||||
editGraphqlRequest,
|
||||
editRESTRequest,
|
||||
@@ -199,8 +200,12 @@ const saveRequestAs = async () => {
|
||||
return
|
||||
}
|
||||
|
||||
// Clone Deep because objects are shared by reference so updating
|
||||
// just one bit will update other referenced shared instances
|
||||
const requestUpdated =
|
||||
props.mode === "rest" ? getRESTRequest() : getGQLSession().request
|
||||
props.mode === "rest"
|
||||
? cloneDeep(getRESTRequest())
|
||||
: cloneDeep(getGQLSession().request)
|
||||
|
||||
// // Filter out all REST file inputs
|
||||
// if (this.mode === "rest" && requestUpdated.bodyParams) {
|
||||
|
||||
Reference in New Issue
Block a user