This is an automated email from the ASF dual-hosted git repository.
shuai pushed a commit to branch feat/baseurl
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
The following commit(s) were added to refs/heads/feat/baseurl by this push:
new 92eec140 fix: navigate function add path conditions
92eec140 is described below
commit 92eec140d76cbb2e82da2b3877007a8498b106ed
Author: shuai <[email protected]>
AuthorDate: Tue Mar 26 11:28:56 2024 +0800
fix: navigate function add path conditions
---
ui/src/utils/floppyNavigation.ts | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
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') {