fix: ensure the reference is not kept while overwriting requests
This commit is contained in:
@@ -1183,6 +1183,7 @@ export function editRESTRequest(
|
||||
requestIndex: number,
|
||||
requestNew: HoppRESTRequest
|
||||
) {
|
||||
debugger
|
||||
const indexPaths = path.split("/").map((x) => parseInt(x))
|
||||
if (
|
||||
!navigateToFolderWithIndexPath(restCollectionStore.value.state, indexPaths)
|
||||
|
||||
@@ -296,6 +296,20 @@ export class PersonalWorkspaceProviderService
|
||||
return Promise.resolve(E.left("INVALID_COLLECTION_HANDLE" as const))
|
||||
}
|
||||
|
||||
const { collectionID, providerID, workspaceID } =
|
||||
parentCollectionHandle.value.data
|
||||
|
||||
const insertionIndex = saveRESTRequestAs(collectionID, newRequest)
|
||||
|
||||
const requestID = `${collectionID}/${insertionIndex}`
|
||||
|
||||
platform.analytics?.logEvent({
|
||||
type: "HOPP_SAVE_REQUEST",
|
||||
workspaceType: "personal",
|
||||
createdNow: true,
|
||||
platform: "rest",
|
||||
})
|
||||
|
||||
return Promise.resolve(
|
||||
E.right(
|
||||
computed(() => {
|
||||
@@ -310,20 +324,6 @@ export class PersonalWorkspaceProviderService
|
||||
}
|
||||
}
|
||||
|
||||
const { collectionID, providerID, workspaceID } =
|
||||
parentCollectionHandle.value.data
|
||||
|
||||
const insertionIndex = saveRESTRequestAs(collectionID, newRequest)
|
||||
|
||||
platform.analytics?.logEvent({
|
||||
type: "HOPP_SAVE_REQUEST",
|
||||
workspaceType: "personal",
|
||||
createdNow: true,
|
||||
platform: "rest",
|
||||
})
|
||||
|
||||
const requestID = `${collectionID}/${insertionIndex}`
|
||||
|
||||
return {
|
||||
type: "ok",
|
||||
data: {
|
||||
@@ -375,6 +375,8 @@ export class PersonalWorkspaceProviderService
|
||||
return Promise.resolve(E.left("INVALID_REQUEST_HANDLE" as const))
|
||||
}
|
||||
|
||||
delete updatedRequest.id
|
||||
|
||||
const { collectionID, requestID, request } = requestHandle.value.data
|
||||
|
||||
const newRequest: HoppRESTRequest = merge(request, updatedRequest)
|
||||
|
||||
Reference in New Issue
Block a user