refactor: resolve() internal links instead of plain hrefs

Type-checks every link against the real route tree. Caught a dead one: the
book page linked tags to /tag/{id}, a route that has never existed.
This commit is contained in:
2026-08-12 11:08:09 -04:00
parent 51c31e6bf6
commit d6207b5743
19 changed files with 588 additions and 487 deletions
@@ -99,6 +99,9 @@ export class BookCollectionState {
const url = new URL(page.url);
url.searchParams.set('view', next);
// Not a route to resolve — this is the current URL with one query param
// changed, so it is already fully qualified.
// eslint-disable-next-line svelte/no-navigation-without-resolve
replaceState(url, page.state);
}
@@ -137,7 +140,8 @@ export class BookCollectionState {
url.searchParams.set('orderBy', this.orderBy);
url.searchParams.set('sortOrder', this.sortOrder);
// pushState(url.toString(), {})
// Same as setView: the current URL with sort params rewritten, not a route.
// eslint-disable-next-line svelte/no-navigation-without-resolve
goto(url.toString());
this.loadNewBooks();
@@ -285,9 +289,7 @@ export class BookCollectionState {
return wanted.every(([key, values]) => {
const current = this.filters[key] ?? [];
return (
current.length === values.length && values.every((value) => current.includes(value))
);
return current.length === values.length && values.every((value) => current.includes(value));
});
}