Skip to content

Commit

Permalink
feat: 定位需要取消渲染和美化 (#2316)
Browse files Browse the repository at this point in the history
  • Loading branch information
song-xiao-lin authored Jan 22, 2025
1 parent 9bb89f2 commit 9e79279
Showing 1 changed file with 36 additions and 18 deletions.
54 changes: 36 additions & 18 deletions app/renderer/src/main/src/components/HTTPFlowDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1206,25 +1206,40 @@ export const HTTPFlowDetailRequestAndResponse: React.FC<HTTPFlowDetailRequestAnd
const [codeKey, setCodeKey] = useState<string>("utf-8")
const [codeLoading, setCodeLoading] = useState<boolean>(false)
const [codeValue, setCodeValue] = useState<string>("")
useEffect(() => {
if (flow) {
setCodeKey("utf-8")
getRemoteValue(RemoteGV.HistoryRequestEditorBeautify).then((res) => {
if (!!res) {
setReqTypeOptionVal(res)
} else {
useDebounceEffect(
() => {
if (flow) {
setCodeKey("utf-8")
const reqArr = highLightItem?.IsMatchRequest ? [highLightItem] : []
const resArr = highLightItem ? (!highLightItem.IsMatchRequest ? [highLightItem] : []) : []
if (reqArr.length) {
setReqTypeOptionVal(undefined)
}
})
getRemoteValue(RemoteGV.HistoryResponseEditorBeautify).then((res) => {
if (!!res) {
setResTypeOptionVal(res)
} else {
getRemoteValue(RemoteGV.HistoryRequestEditorBeautify).then((res) => {
if (!!res) {
setReqTypeOptionVal(res)
} else {
setReqTypeOptionVal(undefined)
}
})
}

if (resArr.length) {
setResTypeOptionVal(undefined)
} else {
getRemoteValue(RemoteGV.HistoryResponseEditorBeautify).then((res) => {
if (!!res) {
setResTypeOptionVal(res)
} else {
setResTypeOptionVal(undefined)
}
})
}
})
}
}, [flow])
}
},
[flow, highLightItem],
{wait: 300}
)

// 响应额外按钮
const secondNodeResExtraBtn = () => {
Expand Down Expand Up @@ -1487,9 +1502,12 @@ export const HTTPFlowDetailRequestAndResponse: React.FC<HTTPFlowDetailRequestAnd
extra={secondNodeResExtraBtn()}
AfterBeautifyRenderBtn={
<>
<YakitButton size='small' onClick={() => {
emiter.emit("onEditTag", JSON.stringify({id: flow.Id, historyId}))
}}>
<YakitButton
size='small'
onClick={() => {
emiter.emit("onEditTag", JSON.stringify({id: flow.Id, historyId}))
}}
>
编辑tag
</YakitButton>
<CodingPopover
Expand Down

0 comments on commit 9e79279

Please sign in to comment.