Skip to content

Commit

Permalink
fix:第二次插件执行时,漏洞风险表小红点数据问题
Browse files Browse the repository at this point in the history
  • Loading branch information
luoluoTH committed Aug 14, 2024
1 parent 2b39549 commit 6870b52
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,12 @@ export const PluginExecuteResult: React.FC<PluginExecuteResultProps> = React.mem
const [tempTotal, setTempTotal] = useState<number>(0) // 在risk表没有展示之前得临时显示在tab上得小红点计数
const [interval, setInterval] = useState<number | undefined>(1000)

useEffect(() => {
return () => {
clearTopIncrement()
}
}, [])
const clearTopIncrement = useInterval(() => {
useUpdateEffect(() => {
setAllTotal(0)
setTempTotal(0)
setInterval(1000)
}, [runtimeId])
useInterval(() => {
if (runtimeId) getTotal()
}, interval)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,10 @@ export const YakitRiskTable: React.FC<YakitRiskTableProps> = React.memo((props)
emiter.on("onRefreshQueryNewRisk", onStartInterval)
return () => {
emiter.off("onRefreshQueryNewRisk", onStartInterval)
clearTopIncrement()
clearTopRedDot()
}
}, [])

const clearTopIncrement = useInterval(() => {
useInterval(() => {
if (beforeId.current) {
getIncrementInTop()
}
Expand All @@ -335,7 +333,7 @@ export const YakitRiskTable: React.FC<YakitRiskTableProps> = React.memo((props)
const intervalRedDot = useCreation(() => {
return offsetDataInTop.length && !interval ? 1000 : undefined
}, [offsetDataInTop, interval])
const clearTopRedDot = useInterval(() => {
useInterval(() => {
const scrollTop = getScrollTop()
if (inViewport && scrollTop < 10 && offsetDataInTop?.length > 0) {
// 滚动条滚动到顶部的时候,如果偏移缓存数据中有数据,第一次优先将缓存数据放在总的数据中
Expand Down

0 comments on commit 6870b52

Please sign in to comment.