Skip to content

Commit 32d3b3e

Browse files
authored
Revert "fix: basic shapes update (#336)"
This reverts commit 1e0211b.
1 parent 1e0211b commit 32d3b3e

3 files changed

Lines changed: 2 additions & 41 deletions

File tree

packages/f-engine/src/canvas/render/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,14 @@ function createElement(parent: VNode, element: JSX.Element): VNode | VNode[] | n
188188
function destroyElement(vNode: VNode | VNode[] | null) {
189189
Children.map(vNode, (node: VNode | null) => {
190190
if (!node) return;
191-
const { component, children, shape, tag } = node;
191+
const { component, children } = node;
192192
if (component) {
193193
component.willUnmount();
194194
destroyElement(children);
195195
component.didUnmount();
196196
component.destroy();
197-
} else if (children) {
197+
} else {
198198
destroyElement(children);
199-
} else if (tag === Shape && shape) {
200-
shape.destroy();
201199
}
202200
});
203201
}

packages/f-engine/test/canvas/render/vnodeUpdate.test.tsx

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -42,41 +42,4 @@ describe('vnode 更新', () => {
4242

4343
expect(ref.current._vNode.props.update).toBe(true);
4444
});
45-
it('基础图形更新', async () => {
46-
const context = createContext();
47-
const { props } = (
48-
<Canvas context={context}>
49-
<rect
50-
style={{
51-
width: 36,
52-
height: 36,
53-
fill: 'red',
54-
}}
55-
/>
56-
</Canvas>
57-
);
58-
59-
const canvas = new Canvas(props);
60-
await canvas.render();
61-
62-
const { props: nextProps } = (
63-
<Canvas context={context}>
64-
<circle
65-
style={{
66-
cx: 80,
67-
cy: 30,
68-
r: 20,
69-
lineWidth: 2,
70-
stroke: '#e45649',
71-
fill: 'blue',
72-
}}
73-
/>
74-
</Canvas>
75-
);
76-
await delay(500);
77-
await canvas.update(nextProps);
78-
79-
await delay(200);
80-
expect(context).toMatchImageSnapshot();
81-
});
8245
});

0 commit comments

Comments
 (0)