feat(core): keep the sidebar instance when the sidebar is collapsed (#8560)

close AF-1507 AF-1506 AF-1479

https://github.com/user-attachments/assets/627242e3-f6f9-44c5-b0c8-87806cbb8489
This commit is contained in:
JimmFly 2024-10-21 06:28:31 +00:00
parent 2c90a95092
commit a25bb0d80f
No known key found for this signature in database
GPG Key ID: 126E0320FEB0D05C
2 changed files with 3 additions and 2 deletions

View File

@ -181,6 +181,7 @@ export function AppSidebar({ children }: PropsWithChildren) {
onOpen={handleOpenChange}
onResizing={handleResizing}
onWidthChange={handleWidthChange}
unmountOnExit={false}
className={clsx(navWrapperStyle, {
[hoverNavWrapperStyle]: sidebarState === 'floating',
})}

View File

@ -19,9 +19,8 @@ export const SidebarSwitch = ({
const preventHovering = useLiveData(appSidebarService.preventHovering$);
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
const switchRef = useRef<HTMLDivElement>(null);
const handleMouseEnter = useCallback(() => {
if (open || preventHovering) {
if (preventHovering || open) {
return;
}
appSidebarService.setHovering(true);
@ -32,6 +31,7 @@ export const SidebarSwitch = ({
clearTimeout(timeoutRef.current);
}
if (open) {
appSidebarService.setHovering(false);
timeoutRef.current = setTimeout(() => {
appSidebarService.setPreventHovering(false);
}, 500);