mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-11-18 18:02:08 +08:00
fix(tests): reset test item state when delay test fails (#8231)
* fix(tests): reset test item state when delay test fails * docs(changelog): note test-item stuck-state fix Co-authored-by: ❤是纱雾酱哟~ <49941141+Dragon1573@users.noreply.github.com> Signed-off-by: ❤是纱雾酱哟~ <49941141+Dragon1573@users.noreply.github.com> --------- Signed-off-by: ❤是纱雾酱哟~ <49941141+Dragon1573@users.noreply.github.com> Co-authored-by: ❤是纱雾酱哟~ <49941141+Dragon1573@users.noreply.github.com>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { LanguageRounded } from '@mui/icons-material'
|
||||
import { Box, Divider, MenuItem, Menu, styled, alpha } from '@mui/material'
|
||||
import { alpha, Box, Divider, Menu, MenuItem, styled } from '@mui/material'
|
||||
import { useLockFn } from 'ahooks'
|
||||
import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
import { useTranslation } from 'react-i18next'
|
||||
@@ -29,8 +29,14 @@ export const TestItem = ({ itemData, onEdit, onDelete: removeTest }: Props) => {
|
||||
|
||||
const onDelay = useCallback(async () => {
|
||||
setDelay(-2)
|
||||
const result = await cmdTestDelay(url!)
|
||||
setDelay(result)
|
||||
try {
|
||||
const result = await cmdTestDelay(url!)
|
||||
setDelay(result)
|
||||
} catch (err) {
|
||||
// A failed test must not leave the item stuck in the loading state.
|
||||
setDelay(-1)
|
||||
showNotice.error(err)
|
||||
}
|
||||
}, [url])
|
||||
|
||||
const onEditTest = () => {
|
||||
|
||||
Reference in New Issue
Block a user