fix: optimize auto translation
This commit is contained in:
@@ -154,9 +154,17 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const lastTranslated = translated
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
translated = translateText
|
translated = translateText
|
||||||
}, 10)
|
}, 10)
|
||||||
|
|
||||||
|
// State change of `translated` triggers markParsing again,
|
||||||
|
// causing redundant translation attempts
|
||||||
|
if (lastTranslated !== translateText) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error)
|
console.error(error)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user