From 95506416dc80ce268cff7acccc3af7af041c014a Mon Sep 17 00:00:00 2001 From: * <8> Date: Thu, 14 Jul 2022 16:43:48 +0800 Subject: [PATCH] Match-id-cf9d94e9056eee2f779cb69c820ebeccdd606f55 --- .../src/renderer/render/LazyComponent.ts | 1 + .../ComponentTest/LazyComponent.test.js | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+) 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