Skip to content

Commit 250ab75

Browse files
fix: string node missing cast to number (#315)
1 parent 791beff commit 250ab75

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

public/common/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ export function getVCSRepositoryPathAndPlatform(url) {
1515
try {
1616
const repo = new URL(url);
1717

18-
const platform = repo.pathname.slice(
18+
const repoPath = repo.pathname.slice(
1919
1,
2020
repo.pathname.includes(".git") ? -4 : repo.pathname.length
2121
);
2222

23-
return [platform, repo.host];
23+
return [repoPath, repo.host];
2424
}
2525
catch {
2626
return null;

public/components/views/home/home.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class HomeView {
5252
const pkg = this.secureDataSet.data.dependencies[name];
5353
const { repository } = pkg.versions[version].links;
5454

55-
if (repository === null) {
55+
if (repository === null || repository === undefined) {
5656
return;
5757
}
5858

public/core/network-navigation.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,14 +107,18 @@ export class NetworkNavigation {
107107
return;
108108
}
109109

110+
if (window.searchbar.background.classList.contains("show")) {
111+
return;
112+
}
113+
110114
const nodeParam = this.#currentNodeParams ?? this.rootNodeParams;
111-
const nodeDependencyName = this.#secureDataSet.linker.get(nodeParam.nodes[0]).name;
115+
const nodeDependencyName = this.#secureDataSet.linker.get(Number(nodeParam.nodes[0])).name;
112116

113117
this.#currentNodeUsedBy = this.#nodes
114-
.filter(([_, opt]) => Object.keys(this.#secureDataSet.linker.get(nodeParam.nodes[0]).usedBy).includes(opt.name));
118+
.filter(([_, opt]) => Object.keys(this.#secureDataSet.linker.get(Number(nodeParam.nodes[0])).usedBy).includes(opt.name));
115119
this.#usedByCurrentNode = this.#nodes.filter(([_, opt]) => Reflect.has(opt.usedBy, nodeDependencyName));
116120

117-
this.#currentNode = this.#nodes.find(([id]) => id === nodeParam.nodes[0]);
121+
this.#currentNode = this.#nodes.find(([id]) => id === Number(nodeParam.nodes[0]));
118122

119123
if (this.#currentLevel > 0 && this.#dependenciesMapByLevel.get(this.#currentLevel - 1) === undefined) {
120124
this.#dependenciesMapByLevel.set(this.#currentLevel - 1, { nodes: [this.#currentNodeUsedBy[0][0]] });

0 commit comments

Comments
 (0)