Skip to content

Commit

Permalink
fix: descending into subcircuit replaces full url with just the file …
Browse files Browse the repository at this point in the history
…name #4
  • Loading branch information
urish committed Mar 17, 2024
1 parent 804c8ae commit 0c9cf36
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/LibraryLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export interface ILibraryDefinition {
}

export class LibraryLoader {
readonly cache = new Map<string, string>();
private readonly cache = new Map<string, string>();
readonly pathToUrl = new Map<string, string>();

baseURL?: string;

Expand Down Expand Up @@ -54,6 +55,7 @@ export class LibraryLoader {
const url = new URL(path, githubURLToRaw(this.baseURL));
const result = await fetch(url);
if (result.ok) {
this.pathToUrl.set(path, url.toString());
return result;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ renderer.onComponentClick.listen(async (path) => {
}

const newParams = new URLSearchParams(window.location.search);
newParams.set('file', path);
newParams.set('file', libraryLoader.pathToUrl.get(path) ?? path);
history.pushState({ path }, '', '?' + newParams.toString());
await render(path);
});
Expand Down

0 comments on commit 0c9cf36

Please sign in to comment.