diff --git a/libs/horizon/src/renderer/render/LazyComponent.ts b/libs/horizon/src/renderer/render/LazyComponent.ts index 7f81ab2a..27feb0af 100644 --- a/libs/horizon/src/renderer/render/LazyComponent.ts +++ b/libs/horizon/src/renderer/render/LazyComponent.ts @@ -61,6 +61,7 @@ function captureLazyComponent( if (lazyRender) { if (lazyVNodeTag === MemoComponent) { // Memo要特殊处理 + processing.effectList = null; const memoVNodeProps = mergeDefaultProps(Component.type, lazyVNodeProps); // 需要整合defaultProps return lazyRender(processing, Component, memoVNodeProps, shouldUpdate); } else { diff --git a/scripts/__tests__/ComponentTest/LazyComponent.test.js b/scripts/__tests__/ComponentTest/LazyComponent.test.js index 704dca45..b59c7805 100755 --- a/scripts/__tests__/ComponentTest/LazyComponent.test.js +++ b/scripts/__tests__/ComponentTest/LazyComponent.test.js @@ -184,4 +184,30 @@ describe('LazyComponent Test', () => { container.querySelector('button').click(); expect(container.textContent).toBe('Error: num is 2'); }); + + it('#24 配合memo', async () => { + const fnComp = () => { + return

horizon

; + }; + const LazyApp = Horizon.lazy(() => ({ + then(cb) { + cb({ default: Horizon.memo(() => fnComp, false) }); + }, + })); + expect(() => { + Horizon.render( + Loading...}> + + , + container + ); + + Horizon.render( + Loading...}> + + , + container + ); + }).not.toThrow(); + }); });