Skip to content

Commit 3d59902

Browse files
committed
Add query mapper param when redirecting from 404
1 parent cf68e51 commit 3d59902

File tree

1 file changed

+10
-1
lines changed
  • packages/react-renderer-demo/src/pages

1 file changed

+10
-1
lines changed

packages/react-renderer-demo/src/pages/404.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,16 @@ const Custom404 = () => {
6464

6565
if (asPath.includes('/component-example/')) {
6666
setLoading(true);
67-
push(asPath.replace('/component-example/', '/mappers/'));
67+
68+
let newPath = asPath.replace('/component-example/', '/mappers/');
69+
70+
if (!newPath.match(/\?mapper=/) && !newPath.match(/#/)) {
71+
newPath = `${newPath}?mapper=mui`;
72+
} else if (!newPath.match(/\?mapper=/)) {
73+
newPath = newPath.replace(/#/, '?mapper=mui#');
74+
}
75+
76+
push(newPath);
6877
} else if (asPath.startsWith('/renderer/condition#') && conditionHashMapper[hash]) {
6978
setLoading(true);
7079
push(`/schema/${conditionHashMapper[hash]}`);

0 commit comments

Comments
 (0)