feat : smart tree component (#2865)
Co-authored-by: Andrew Bastin <andrewbastin.k@gmail.com> Co-authored-by: Liyas Thomas <liyascthomas@gmail.com>
This commit is contained in:
@@ -331,14 +331,25 @@ const setRestReq = (request: HoppRESTRequest | null | undefined) => {
|
||||
// (That is not a really good behaviour tho ¯\_(ツ)_/¯)
|
||||
const useHistory = (entry: RESTHistoryEntry) => {
|
||||
const currentFullReq = getRESTRequest()
|
||||
|
||||
const currentReqWithNoChange = getRESTSaveContext()?.req
|
||||
|
||||
// checks if the current request is the same as the save context request if present
|
||||
if (
|
||||
currentReqWithNoChange &&
|
||||
isEqualHoppRESTRequest(currentReqWithNoChange, currentFullReq)
|
||||
) {
|
||||
props.page === "rest" && setRestReq(entry.request)
|
||||
clickedHistory.value = entry
|
||||
}
|
||||
// Initial state trigers a popup
|
||||
if (!clickedHistory.value) {
|
||||
else if (!clickedHistory.value) {
|
||||
clickedHistory.value = entry
|
||||
confirmChange.value = true
|
||||
return
|
||||
}
|
||||
// Checks if there are any change done in current request and the history request
|
||||
if (
|
||||
else if (
|
||||
!isEqualHoppRESTRequest(
|
||||
currentFullReq,
|
||||
clickedHistory.value.request as HoppRESTRequest
|
||||
@@ -347,7 +358,7 @@ const useHistory = (entry: RESTHistoryEntry) => {
|
||||
clickedHistory.value = entry
|
||||
confirmChange.value = true
|
||||
} else {
|
||||
props.page === "rest" && setRestReq(entry.request as HoppRESTRequest)
|
||||
props.page === "rest" && setRestReq(entry.request)
|
||||
clickedHistory.value = entry
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user