Skip to content

Commit 178d24c

Browse files
authored
fix: minor fixes (#100)
* fix(BlockGroups): BlouckGroups should be properly unmounted * fix(MultipointConnection): unhandled error when points is missing * chore(stories): fix some compiler error * chore: add export of Component
1 parent 34761f2 commit 178d24c

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

src/components/canvas/groups/BlockGroups.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,12 @@ export class BlockGroups<P extends BlockGroupsProps = BlockGroupsProps> extends
146146

147147
protected unmountLayer(): void {
148148
this.props.graph.rootStore.groupsList.reset();
149+
super.unmountLayer();
149150
}
150151

151152
protected unmount(): void {
152153
this.unsubscribe.forEach((unsubscribe) => unsubscribe());
154+
super.unmount();
153155
}
154156

155157
protected getGroupComponent(group: GroupState) {

src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ export * from "./components/canvas/groups";
2424

2525
export * from "./components/canvas/layers/newBlockLayer/NewBlockLayer";
2626
export * from "./components/canvas/layers/connectionLayer/ConnectionLayer";
27+
export * from "./lib/Component";

src/react-components/elk/components/MultipointConnection.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ export class MultipointConnection extends BlockConnection<TMultipointConnection>
1414
private labelsGeometry: { x: number; y: number; width: number; height: number }[] = [];
1515

1616
public createPath() {
17-
const { points } = this.connectedState.$state.value;
17+
const points = this.getPoints();
1818
if (!points.length) {
1919
return super.createPath();
2020
}
2121
return curvePolyline(points, 10);
2222
}
2323

2424
public createArrowPath(): Path2D {
25-
const { points } = this.connectedState.$state.value;
25+
const points = this.getPoints();
2626
if (!points.length) {
2727
return undefined;
2828
}
@@ -54,7 +54,7 @@ export class MultipointConnection extends BlockConnection<TMultipointConnection>
5454
}
5555

5656
public getBBox() {
57-
const { points } = this.connectedState.$state.value;
57+
const points = this.getPoints();
5858
if (!points.length) {
5959
return super.getBBox();
6060
}

src/stories/examples/imageByBlocks/imageByBlocks.stories.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { ThemeProvider } from "@gravity-ui/uikit";
55
import type { Meta, StoryFn } from "@storybook/react";
66

77
import { CanvasBlock, Graph, TBlock, TGraphConfig } from "../../../index";
8-
import { TRenderBlockFn } from "../../../react-components";
98
import { storiesSettings } from "../../../stories/configurations/definitions";
109
import { GraphComponentStory } from "../../main/GraphEditor";
1110

@@ -92,7 +91,7 @@ const GraphApp = () => {
9291

9392
const [config, setConfig] = useState<TGraphConfig | undefined>();
9493

95-
const renderBlockFn: TRenderBlockFn = useCallback(() => {
94+
const renderBlockFn = useCallback(() => {
9695
return null;
9796
}, []);
9897

0 commit comments

Comments
 (0)