feat: versioned endpoints on client (#63441)

This commit is contained in:
Mrugesh Mohapatra
2025-11-04 05:05:23 +05:30
committed by GitHub
parent 88fa4039b9
commit c801dcdbcb
9 changed files with 267 additions and 2 deletions
@@ -119,4 +119,24 @@ describe('Layout selector', () => {
const componentObj = getComponentNameAndProps(Certification, challengePath);
expect(componentObj.name).toEqual('CertificationLayout');
});
test('Status paths should return raw element without layout', () => {
const TestComponent = () => <div>Test</div>;
const statusPath = '/status/version';
const result = layoutSelector({
element: { type: TestComponent, props: {}, key: '' },
props: {
data: {},
location: {
pathname: statusPath
},
params: { '*': '' },
path: ''
}
});
// The result should be the element directly, not wrapped in a layout
expect(result.type).toBe(TestComponent);
});
});
+5
View File
@@ -27,6 +27,11 @@ export default function layoutSelector({
const isChallenge = !!props.pageContext?.challengeMeta || isDailyChallenge;
// Return raw element for status endpoints without any layout
if (/^\/status\//.test(pathname)) {
return element;
}
if (element.type === FourOhFourPage) {
return (
<DefaultLayout pathname={pathname} showFooter={true}>