Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

fix: navigate function add path conditions

shuai92eec140d76c
diff --git a/ui/src/utils/floppyNavigation.ts b/ui/src/utils/floppyNavigation.ts
index 30be62ca..69ba4e88 100644
--- a/ui/src/utils/floppyNavigation.ts
+++ b/ui/src/utils/floppyNavigation.ts
@@ -151,7 +151,14 @@ const navigate = (to: string | number, config: NavigateConfig = {}) => {
}
window.location.replace(to);
} else if (typeof handler === 'function') {
- handler(to === '/test' ? '/' : to, config.options);
+ if (to === '/test') {
+ to = '/';
+ }
+
+ if (to !== '/test' && to.startsWith('/test')) {
+ to = to.replace('/test', '');
+ }
+ handler(to, config.options);
}
}
if (typeof to === 'number' && typeof handler === 'function') {