Match-id-a259fe636f4eae5da9d6448d48172e8ce9dcfcee
This commit is contained in:
parent
76e84e5022
commit
0b11905b35
|
@ -230,7 +230,7 @@ export function onlyUpdateChildVNodes(processing: VNode): VNode | null {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
putChildrenIntoQueue(processing.child);
|
putChildrenIntoQueue(processing);
|
||||||
|
|
||||||
while (queue.length) {
|
while (queue.length) {
|
||||||
const vNode = queue.shift()!;
|
const vNode = queue.shift()!;
|
||||||
|
|
|
@ -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();
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue