fix(lab-content-engine): phase 3 - устранён блокер ревью (loader не был подключён)
Два edit'а Фазы 3 не применились в fc1139f (упали по отступу), запушив
сломанное состояние: lab.html убрал eager sim-скрипты, но open остался
синхронным -> ReferenceError при клике на любую симуляцию кроме graph.
ИСПРАВЛЕНО:
- _register-all.js: open-обёртка LabLoader.ensure(id).then(rawOpen) + sync-фолбэк
- lab-init.js openSim: обработка Promise от open() (.then -> lucide, .catch -> log)
E2E vm-harness: click->ensure->load->rawOpen после загрузки; pendulum/stereo:cube/
molphys(4 файла)/alias magnetic — ALL PASS; node --check OK.
Независимое ревью поймало этот блокер.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -116,9 +116,18 @@
|
||||
const _m = window.LabRegistry.get(_cid);
|
||||
const _arg = _cid.includes(':') ? _cid.split(':')[1] : undefined;
|
||||
window.LabRegistry.setActive(_m);
|
||||
try { _m.open({ id: _cid, arg: _arg }); }
|
||||
catch (e) { console.error('[LabRegistry] open failed:', _cid, e); }
|
||||
if (window.lucide) lucide.createIcons();
|
||||
// Фаза 3: open() может вернуть Promise (ленивая загрузка кода). Иконки
|
||||
// перерисовываем после фактической инициализации тела симуляции; ошибку
|
||||
// асинхронной загрузки ловим через .catch (sync try/catch её не поймает).
|
||||
try {
|
||||
const _r = _m.open({ id: _cid, arg: _arg });
|
||||
if (_r && typeof _r.then === 'function') {
|
||||
_r.then(function () { if (window.lucide) lucide.createIcons(); })
|
||||
.catch(function (e) { console.error('[LabRegistry] open failed:', _cid, e); });
|
||||
} else if (window.lucide) {
|
||||
lucide.createIcons();
|
||||
}
|
||||
} catch (e) { console.error('[LabRegistry] open failed:', _cid, e); }
|
||||
return;
|
||||
}
|
||||
if (window.console) console.warn('[LabRegistry] неизвестная симуляция:', id);
|
||||
|
||||
Reference in New Issue
Block a user