feat: enhanced hook function functionality

This commit is contained in:
Gabe
2025-08-27 01:02:11 +08:00
parent fd2f0e513b
commit 5c44ba1da8
4 changed files with 38 additions and 33 deletions

View File

@@ -14,7 +14,7 @@ import { kissLog } from "../libs/log";
*/
export function useTranslate(q, rule, setting) {
const [text, setText] = useState("");
const [loading, setLoading] = useState(false);
const [loading, setLoading] = useState(true);
const [sameLang, setSamelang] = useState(false);
const { translator, fromLang, toLang, detectRemote, skipLangs = [] } = rule;
@@ -22,8 +22,6 @@ export function useTranslate(q, rule, setting) {
useEffect(() => {
(async () => {
try {
setLoading(true);
if (!q.replace(/\[(\d+)\]/g, "").trim()) {
setText(q);
setSamelang(false);