Skip to content

Commit 84b63a8

Browse files
committed
fix/refactor: default to version main when version is undefine
1 parent 7fd97f6 commit 84b63a8

File tree

1 file changed

+16
-21
lines changed

1 file changed

+16
-21
lines changed

src/components/conformance/utils.ts

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -28,28 +28,23 @@ export function updateInitialConformanceState(
2828
urlState: UrlState,
2929
conformanceState: ConformanceState,
3030
) {
31-
if (
32-
!conformanceState &&
33-
(urlState.versionTag || urlState.testPath || urlState.selectedTest)
34-
) {
35-
const selectedTest = urlState.testPath ? urlState.selectedTest : undefined;
36-
const tagName = (!urlState.versionTag) && urlState.testPath ? "main" : urlState.versionTag;
37-
const fetchUrl =
38-
tagName === "main"
39-
? `https://raw.githubusercontent.com/boa-dev/data/main/test262/refs/heads/main/latest.json`
40-
: `https://raw.githubusercontent.com/boa-dev/data/main/test262/refs/tags/${tagName}/latest.json`;
31+
if (conformanceState) return conformanceState;
32+
const selectedTest = urlState.testPath ? urlState.selectedTest : undefined;
33+
const tagName = (!urlState.versionTag) && urlState.testPath ? "main" : urlState.versionTag;
34+
const fetchUrl =
35+
tagName === "main"
36+
? `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/${tagName}/latest.json`;
4138

42-
const testPath = urlState.testPath || [];
43-
if (!tagName && testPath.length == 0 && !selectedTest) return conformanceState;
44-
return {
45-
version: { tagName, fetchUrl },
46-
testPath: [tagName, ...testPath],
47-
ecmaScriptVersion: undefined,
48-
sortOption: availableSortingOptions[0].id,
49-
selectedTest: selectedTest,
50-
};
51-
}
52-
return conformanceState;
39+
const testPath = urlState.testPath || [];
40+
if (!tagName && testPath.length == 0 && !selectedTest) return conformanceState;
41+
return {
42+
version: { tagName, fetchUrl },
43+
testPath: [tagName, ...testPath],
44+
ecmaScriptVersion: undefined,
45+
sortOption: availableSortingOptions[0].id,
46+
selectedTest: selectedTest,
47+
};
5348
}
5449

5550
export function createSearchParams(

0 commit comments

Comments
 (0)