test: 补 useEffect 桩(183 起既有失败,与本轮无关)

This commit is contained in:
qiqi committed 2026-12-02 18:07:44 +08:00
1 parent af9d261636
commit 71cd7bc41e
1 file changed
+2
+2
View File
@@ -14,6 +14,8 @@ const React = {
return { type, props: Object.assign({}, props || {}, { children }) }
},
useState(init) { return [init, function () {}] },
// 183 起 ResultImg 用 useEffect 订阅落地状态;假 React 必须提供(既有失败,与本次回滚无关)
useEffect(fn) { try { const c = fn && fn(); if (typeof c === 'function') c() } catch (e) { /* ignore */ } },
}
const sandbox = { React }
vm.runInNewContext(fs.readFileSync(path.join(root, 'src', 'ui-components.js'), 'utf8'), sandbox)