Skip to content

Commit 122ed7b

Browse files
committed
chore: tweak reset
1 parent 204c84a commit 122ed7b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

frontend/routes/package/(_islands)/DependencyGraph.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function createDigraph(dependencies: DependencyGraphProps["dependencies"]) {
5555
node [fontname="Courier", shape="box", style="filled,rounded"]
5656
5757
${
58-
dependencies.map(({ children, size, dependency }, index) => {
58+
dependencies.map(({ children, dependency, size }, index) => {
5959
return [
6060
` ${index} ${renderDependency(dependency, size)}`,
6161
...children.map((child) => ` ${index} -> ${child}`),
@@ -82,7 +82,7 @@ function renderDependency(dependency: DependencyGraphKind, size?: number) {
8282
tooltip =
8383
`@${dependency.scope}/${dependency.package}@${dependency.version}`;
8484
href = `/${tooltip}`;
85-
content = tooltip + `\n${dependency.path}\n${bytesToSize(size ?? 0)}`;
85+
content = `${tooltip}\n${dependency.path}\n${bytesToSize(size ?? 0)}`;
8686
color = "#faee4a";
8787
break;
8888
}
@@ -93,7 +93,7 @@ function renderDependency(dependency: DependencyGraphKind, size?: number) {
9393
break;
9494
}
9595
case "root": {
96-
tooltip = content = dependency.path;
96+
content = tooltip = dependency.path;
9797
color = "#67bef9";
9898
break;
9999
}
@@ -128,7 +128,7 @@ function useDigraph(dependencies: DependencyGraphProps["dependencies"]) {
128128
defaults.value.pan.x = (rWidth - sWidth) / 2;
129129
defaults.value.pan.y = (rHeight - sHeight) / 2;
130130
defaults.value.zoom = Math.min(rWidth / sWidth, rHeight / sHeight);
131-
controls.value = { ...defaults.value };
131+
controls.value = structuredClone(defaults.value);
132132
svg.current.style.transform =
133133
`translate(${controls.value.pan.x}px, ${controls.value.pan.y}px) scale(${controls.value.zoom})`;
134134
}
@@ -156,7 +156,7 @@ function useDigraph(dependencies: DependencyGraphProps["dependencies"]) {
156156
}, []);
157157

158158
const reset = useCallback(() => {
159-
controls.value = { ...defaults.value };
159+
controls.value = structuredClone(defaults.value);
160160
if (svg.current) {
161161
svg.current.style.transform =
162162
`translate(${controls.value.pan.x}px, ${controls.value.pan.y}px) scale(${controls.value.zoom})`;

0 commit comments

Comments
 (0)