Skip to content

Commit 416b588

Browse files
terapyonterapyon
authored andcommitted
bugfix for ts
1 parent 2216dc7 commit 416b588

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
"@lumino/widgets": "pinned to the latest Lumino 1.x release"
9595
},
9696
"jupyterlab": {
97-
"extension": "lib/plugin",
97+
"extension": true,
9898
"mimeExtension": true,
9999
"outputDir": "net_vis/labextension/",
100100
"sharedPackages": {

src/graph.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ function Graph(svg: any, { nodes, links }: { nodes: Node[]; links: Link[] }) {
6868
.forceSimulation(nodes)
6969
.force(
7070
'link',
71-
d3.forceLink(links).id((d: any) => (d as Node).id.toString()),
71+
d3.forceLink(links).id((d: any) => {
72+
// Safely access id with null check
73+
const node = d as Node;
74+
return node && node.id ? String(node.id) : '';
75+
}),
7276
)
7377
.force('charge', d3.forceManyBody())
7478
.force('center', d3.forceCenter(400, 400));

src/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
// Copyright (c) Manabu TERADA
22
// Distributed under the terms of the Modified BSD License.
33

4+
// Export plugin as default for JupyterLab to load
5+
export { default } from './plugin';
6+
7+
// Export other modules for backward compatibility
48
export * from './version';
59
export * from './widget';

0 commit comments

Comments
 (0)