Skip to content

Commit

Permalink
fix: search redirects to the latest version when on stable version (#511
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Oreoxmt authored Aug 26, 2024
1 parent 9044798 commit f37528b
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/templates/DocSearchTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import {
import { Locale } from "static/Type";
import { FeedbackSurveyCampaign } from "components/Campaign/FeedbackSurvey";

// TiDB: get latest two LTS versions + latest DMR version
// TiDB: get searchable versions from fetchTidbSearchIndcies
// TiDB Cloud: only has one version
// TiDB Operator: get stable version
// TiDB Data Migration: get latest version
Expand Down Expand Up @@ -101,10 +101,6 @@ const convertStableToRealVersion = (
return realVersion;
};

// TiDB: get latest two LTS versions + latest DMR version
// TiDB Cloud: only has one version
// TiDB Operator: get stable version
// TiDB Data Migration: get latest version
const getSearchIndexVersion = (
docType: string,
docVersion: string,
Expand All @@ -113,10 +109,11 @@ const getSearchIndexVersion = (
switch (docType) {
case "tidb":
const versions = fetchVersionListByDocType(docType, lang);
const realVersion =
let realVersion =
docVersion === "stable" ? replaceStableVersion(docType) : docVersion;
realVersion = realVersion?.replace("release-", "v");
if (versions.includes(realVersion || "")) {
return realVersion?.replace("release-", "v");
return realVersion;
}

const latestVersion = versions[0];
Expand Down

0 comments on commit f37528b

Please sign in to comment.