refactor: introduce writable handles to signify updates to handle references

A special list of writable handles is compiled in a list while issuing handles (request/collection creation, etc). Instead of manually computing the tab and toggling the dirty state, the writable handle is updated (changing the type to invalid on request deletion) and the tab with the request open can infer it via the update reflected in the request handle under the tab save context (reactive update trigger).
This commit is contained in:
jamesgeorge007
2024-04-23 22:21:13 +05:30
parent 8467417e7a
commit cd92dfec47
7 changed files with 230 additions and 110 deletions

View File

@@ -1118,15 +1118,6 @@ const onRemoveRequest = async () => {
return
}
const { providerID, requestID, workspaceID } = requestHandle.value.data
const possibleTab = tabs.getTabRefWithSaveContext({
originLocation: "workspace-user-collection",
workspaceID,
providerID,
requestID,
})
if (
isSelected({
requestIndex: parseInt(requestIndexPath.split("/").pop() ?? ""),
@@ -1143,12 +1134,6 @@ const onRemoveRequest = async () => {
return
}
// If there is a tab attached to this request, dissociate its state and mark it dirty
if (possibleTab) {
possibleTab.value.document.saveContext = null
possibleTab.value.document.isDirty = true
}
toast.success(t("state.deleted"))
displayConfirmModal(false)
}