fix: force full reload when leaving review detail

This commit is contained in:
wren
2026-05-06 18:02:05 +08:00
parent 5405d30111
commit 153865c734
+13 -2
View File
@@ -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)}
>