Match-id-dcf7a130ccdbb700a356b5d73fc31747e3c28099

This commit is contained in:
* 2022-09-14 15:02:16 +08:00 committed by *
commit 546d19dfe4
2 changed files with 42 additions and 1 deletions

View File

@ -230,7 +230,7 @@ export function onlyUpdateChildVNodes(processing: VNode): VNode | null {
}
};
putChildrenIntoQueue(processing.child);
putChildrenIntoQueue(processing);
while (queue.length) {
const vNode = queue.shift()!;

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
*/
import * as Horizon from '@cloudsop/horizon/index.ts';
describe('Memo Test', () => {
it('Memo should not make the path wrong', function () {
let updateApp;
function Child() {
const [_, update] = Horizon.useState({});
updateApp = () => update({});
return <div></div>;
}
const MemoChild = Horizon.memo(Child);
function App() {
return (
<div>
<MemoChild />
</div>
);
}
const MemoApp = Horizon.memo(App);
Horizon.render(
<div>
<MemoApp key="1" />
</div>,
container
);
Horizon.render(
<div>
<span></span>
<MemoApp key="1" />
</div>,
container
);
expect(() => updateApp()).not.toThrow();
});
});