feat: add BYOC support for TiDB Cloud navigation and content#718
feat: add BYOC support for TiDB Cloud navigation and content#718shhdgit wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for a new "BYOC" (Bring Your Own Cloud) plan across the TiDB Cloud documentation website. The changes include updating the CloudPlan enum, adding GraphQL schema extensions for BYOC navigation, updating UI components (such as the header navigation and version selector), adding translations, and implementing corresponding tests. The review feedback focuses on code quality improvements, such as simplifying redundant conditional checks in the plan detection logic, using a more maintainable enum check via Object.values in useCloudPlan.ts, and formatting a template literal for better readability in CloudVersionSelect.tsx.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| if ( | ||
| byoc.has(fileName) && | ||
| !premium.has(fileName) && | ||
| !essential.has(fileName) && | ||
| !dedicated.has(fileName) && | ||
| !starter.has(fileName) | ||
| ) { | ||
| return CloudPlan.Byoc; | ||
| } |
There was a problem hiding this comment.
Since this is the final check in a sequence of if-else style conditions, we already know that fileName is not present in dedicated, starter, essential, or premium (otherwise, the function would have already returned). Therefore, we can simplify this condition to just check byoc.has(fileName).
if (byoc.has(fileName)) {
return CloudPlan.Byoc;
}| function isCloudPlan(value: string | null): value is CloudPlan { | ||
| return ( | ||
| value === CloudPlan.Dedicated || | ||
| value === CloudPlan.Starter || | ||
| value === CloudPlan.Essential || | ||
| value === CloudPlan.Premium | ||
| value === CloudPlan.Premium || | ||
| value === CloudPlan.Byoc | ||
| ); | ||
| } |
There was a problem hiding this comment.
Instead of manually listing all enum values in the comparison, we can use Object.values(CloudPlan).includes() to check if the value is a valid CloudPlan. This is more maintainable as it automatically supports any new plans added to the CloudPlan enum in the future.
function isCloudPlan(value: string | null): value is CloudPlan {
return Object.values(CloudPlan).includes(value as CloudPlan);
}| if (version === CloudPlan.Byoc) { | ||
| return `/${pathConfig.repo}/${ | ||
| CloudPlan.Premium | ||
| }/?${searchParams.toString()}`; | ||
| } |
No description provided.