refactor: 移除 slug 自动生成器中的冗余状态变量

This commit is contained in:
seahi committed 2026-08-07 14:24:52 +08:00
1 parent 4a4d07ddae
commit 8db10e3ad0
1 file changed
-3
-3
View File
@@ -35,7 +35,6 @@ export function createSlugAutoHandler(opts: {
}) {
const delay = opts.delayMs ?? 400;
let timer: ReturnType<typeof setTimeout> | null = null;
let isGenerating = false;
return {
/**
@@ -53,13 +52,11 @@ export function createSlugAutoHandler(opts: {
}
timer = setTimeout(async () => {
isGenerating = true;
const generated = await fetchSlug(nameValue);
// 在异步返回后,再次确认用户期间没有手动修改 slug
if (!opts.getIsUserModified() && generated) {
opts.setSlug(generated);
}
isGenerating = false;
}, delay);
},