From 92eec140d76cbb2e82da2b3877007a8498b106ed Mon Sep 17 00:00:00 2001 From: shuai Date: Tue, 26 Mar 2024 11:28:56 +0800 Subject: [PATCH] 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') {