diff --git a/frontend/src/OspfToolsPage.jsx b/frontend/src/OspfToolsPage.jsx index 27e87fa..eb4099b 100644 --- a/frontend/src/OspfToolsPage.jsx +++ b/frontend/src/OspfToolsPage.jsx @@ -320,18 +320,17 @@ export default function OspfToolsPage() { let changedCount = 0; let hintedCount = 0; - setTemplates((prev) => - prev.map((item) => { - const hintKey = `${item.routerKey}::${item.area}::${String(item.interfaceName || '').toUpperCase()}`; - const hint = hints[hintKey]; - if (!hint) return item; - hintedCount += 1; - const nextCost = Number(hint.optimalCost); - if (!Number.isFinite(nextCost) || nextCost < 0 || Number(item.cost) === nextCost) return item; - changedCount += 1; - return { ...item, cost: nextCost }; - }) - ); + const nextTemplates = (templates || []).map((item) => { + const hintKey = `${item.routerKey}::${item.area}::${String(item.interfaceName || '').toUpperCase()}`; + const hint = hints[hintKey]; + if (!hint) return item; + hintedCount += 1; + const nextCost = Number(hint.optimalCost); + if (!Number.isFinite(nextCost) || nextCost < 0 || Number(item.cost) === nextCost) return item; + changedCount += 1; + return { ...item, cost: nextCost }; + }); + setTemplates(nextTemplates); if (hintedCount === 0) { notify.warning('Для интерфейсов на странице нет рекомендаций оптимизатора');