Skip to content

Commit 7fd97f6

Browse files
committed
search param fix
1 parent 56b4a6b commit 7fd97f6

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/components/conformance/utils.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
VersionedStats,
1212
VersionItem,
1313
} from "@site/src/components/conformance/types";
14+
import { url } from "node:inspector";
1415

1516
// Take a search param and create a state object
1617
export function createUrlState(search: string): UrlState {
@@ -31,18 +32,21 @@ export function updateInitialConformanceState(
3132
!conformanceState &&
3233
(urlState.versionTag || urlState.testPath || urlState.selectedTest)
3334
) {
35+
const selectedTest = urlState.testPath ? urlState.selectedTest : undefined;
36+
const tagName = (!urlState.versionTag) && urlState.testPath ? "main" : urlState.versionTag;
3437
const fetchUrl =
35-
urlState.versionTag === "main"
38+
tagName === "main"
3639
? `https://raw.githubusercontent.com/boa-dev/data/main/test262/refs/heads/main/latest.json`
37-
: `https://raw.githubusercontent.com/boa-dev/data/main/test262/refs/tags/${urlState.versionTag}/latest.json`;
40+
: `https://raw.githubusercontent.com/boa-dev/data/main/test262/refs/tags/${tagName}/latest.json`;
3841

3942
const testPath = urlState.testPath || [];
43+
if (!tagName && testPath.length == 0 && !selectedTest) return conformanceState;
4044
return {
41-
version: { tagName: urlState.versionTag, fetchUrl },
42-
testPath: [urlState.versionTag, ...testPath],
45+
version: { tagName, fetchUrl },
46+
testPath: [tagName, ...testPath],
4347
ecmaScriptVersion: undefined,
4448
sortOption: availableSortingOptions[0].id,
45-
selectedTest: urlState.selectedTest,
49+
selectedTest: selectedTest,
4650
};
4751
}
4852
return conformanceState;

0 commit comments

Comments
 (0)