Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/routes/[package]/+layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import { error } from '@sveltejs/kit';
import type { LayoutLoad } from './$types';
import { packages, type PackageId } from '$lib/config/packages';
import { getPackageManifest } from '$lib/api/versions';
import { versionStore } from '$lib/stores/versionStore';

const validPackageIds = new Set<string>(Object.keys(packages));

/**
* Top-level loader for an unversioned package URL like /pathsim or /batt.
* Loads the package manifest and picks a tag (stored preference or latest)
* Loads the package manifest and picks the latest tag
* so the overview page can show the version selector + sidebar links.
*
* The deeper /[package]/[version]/ layout supersedes the `selectedTag` value
Expand All @@ -23,8 +22,7 @@ export const load: LayoutLoad = async ({ params, fetch }) => {

try {
const manifest = await getPackageManifest(packageId, fetch);
const stored = versionStore.getVersionSync(packageId as PackageId);
const selectedTag = stored || manifest.latestTag;
const selectedTag = manifest.latestTag;

return {
packageId: packageId as PackageId,
Expand Down