fix: force full reload when leaving review detail
This commit is contained in:
@@ -110,6 +110,15 @@ export function Sidebar({ onToggle, collapsed, userRole, frontendJWT = '' }: Sid
|
||||
const isCrossCheckingPath = isPathInSection('/cross-checking');
|
||||
const isChatPath = isPathInSection('/chat-with-llm');
|
||||
const isContractTemplatePath = isPathInSection('/contract-template') || isPathInSection('/contract-draft');
|
||||
const shouldForceDocumentNavigation = isPathInSection('/reviewsTest');
|
||||
|
||||
const navigateWithFallback = (path: string) => {
|
||||
if (shouldForceDocumentNavigation && typeof window !== 'undefined') {
|
||||
window.location.assign(path);
|
||||
return;
|
||||
}
|
||||
navigate(path);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (typeof window !== 'undefined') {
|
||||
@@ -509,14 +518,14 @@ export function Sidebar({ onToggle, collapsed, userRole, frontendJWT = '' }: Sid
|
||||
<div className="py-6 px-4 border-b border-gray-100 flex justify-between items-center">
|
||||
<div className="flex items-center"
|
||||
onClick={() => {
|
||||
navigate('/');
|
||||
navigateWithFallback('/');
|
||||
}}
|
||||
role="button"
|
||||
tabIndex={0}
|
||||
onKeyDown={(e) => {
|
||||
if (e.key === 'Enter' || e.key === ' ') {
|
||||
e.preventDefault();
|
||||
navigate('/');
|
||||
navigateWithFallback('/');
|
||||
}
|
||||
}}
|
||||
>
|
||||
@@ -571,6 +580,7 @@ export function Sidebar({ onToggle, collapsed, userRole, frontendJWT = '' }: Sid
|
||||
{!item.children ? (
|
||||
<Link
|
||||
to={item.path}
|
||||
reloadDocument={shouldForceDocumentNavigation}
|
||||
className={`sidebar-menu-item ${isActive(item.path) ? 'active' : ''} flex items-center ${collapsed ? 'justify-center' : ''}`}
|
||||
onClick={(e) => {
|
||||
// 只阻止冒泡,不阻止默认行为
|
||||
@@ -618,6 +628,7 @@ export function Sidebar({ onToggle, collapsed, userRole, frontendJWT = '' }: Sid
|
||||
<Link
|
||||
key={child.id}
|
||||
to={child.path}
|
||||
reloadDocument={shouldForceDocumentNavigation}
|
||||
className={`sidebar-menu-item ${isActive(child.path) ? 'active' : ''} flex items-center ${collapsed ? 'justify-center' : ''}`}
|
||||
onClick={(e) => handleSubMenuClick(child, e)}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user