don't let progress bar go backwards
This commit is contained in:
parent
646f77f9f8
commit
b7e8f8faaa
|
@ -3499,16 +3499,16 @@ export async function executeSlashCommandsOnChatInput(text, options = {}) {
|
||||||
|
|
||||||
/**@type {SlashCommandClosureResult} */
|
/**@type {SlashCommandClosureResult} */
|
||||||
let result = null;
|
let result = null;
|
||||||
let currentProgress = '';
|
let currentProgress = 0;
|
||||||
try {
|
try {
|
||||||
commandsFromChatInputAbortController = new SlashCommandAbortController();
|
commandsFromChatInputAbortController = new SlashCommandAbortController();
|
||||||
result = await executeSlashCommandsWithOptions(text, {
|
result = await executeSlashCommandsWithOptions(text, {
|
||||||
abortController: commandsFromChatInputAbortController,
|
abortController: commandsFromChatInputAbortController,
|
||||||
onProgress: (done, total) => {
|
onProgress: (done, total) => {
|
||||||
const newProgress = `${done / total * 100}%`;
|
const newProgress = done / total;
|
||||||
if (newProgress !== currentProgress) {
|
if (newProgress > currentProgress) {
|
||||||
currentProgress = newProgress;
|
currentProgress = newProgress;
|
||||||
ta.style.setProperty('--prog', newProgress);
|
ta.style.setProperty('--prog', `${newProgress * 100}%`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
parserFlags: options.parserFlags,
|
parserFlags: options.parserFlags,
|
||||||
|
|
Loading…
Reference in New Issue