fix(web): renderNode 内 t 被 task 参数遮蔽导致 t is not a function
renderNode=(t)=> 里 t 是任务对象,line 1418 的 t('depsWait') 调用
全局 i18n 函数时 t 已被遮蔽。在 renderNode 前保存 const i18n=t,
内部改用 i18n(),消除 "t is not a function" 错误。
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-1
@@ -1393,6 +1393,7 @@ function renderTree() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const byId = new Map(S.tasks.map((x) => [x.id, x]));
|
const byId = new Map(S.tasks.map((x) => [x.id, x]));
|
||||||
|
const i18n = t; // t will be shadowed by the task parameter inside renderNode
|
||||||
const renderNode = (t) => {
|
const renderNode = (t) => {
|
||||||
if (vis && !vis.visible.has(t.id)) return '';
|
if (vis && !vis.visible.has(t.id)) return '';
|
||||||
const kids = m.get(t.id) || [];
|
const kids = m.get(t.id) || [];
|
||||||
@@ -1415,7 +1416,7 @@ function renderTree() {
|
|||||||
const unmet = t.deps.filter((d) => byId.get(d)?.status !== 'done');
|
const unmet = t.deps.filter((d) => byId.get(d)?.status !== 'done');
|
||||||
if (!unmet.length) return '';
|
if (!unmet.length) return '';
|
||||||
const depSep2 = i18nState.lang === 'zh' ? '、' : ', ';
|
const depSep2 = i18nState.lang === 'zh' ? '、' : ', ';
|
||||||
return `<span class="t-deps-wait" title="${unmet.map((d) => esc(byId.get(d)?.title || d)).join(depSep2)}">${icon('deps')} ${t('depsWait', { n: unmet.length })}</span>`;
|
return `<span class="t-deps-wait" title="${unmet.map((d) => esc(byId.get(d)?.title || d)).join(depSep2)}">${icon('deps')} ${i18n('depsWait', { n: unmet.length })}</span>`;
|
||||||
})()}
|
})()}
|
||||||
<span class="t-prio ${t.priority === 0 ? 'hot' : ''}">P${t.priority}</span>
|
<span class="t-prio ${t.priority === 0 ? 'hot' : ''}">P${t.priority}</span>
|
||||||
${cplxBadge(t.complexity, t.id)}
|
${cplxBadge(t.complexity, t.id)}
|
||||||
|
|||||||
Reference in New Issue
Block a user