mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-29 15:22:02 +03:00
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:
parent
2c90a95092
commit
a25bb0d80f
@ -181,6 +181,7 @@ export function AppSidebar({ children }: PropsWithChildren) {
|
||||
onOpen={handleOpenChange}
|
||||
onResizing={handleResizing}
|
||||
onWidthChange={handleWidthChange}
|
||||
unmountOnExit={false}
|
||||
className={clsx(navWrapperStyle, {
|
||||
[hoverNavWrapperStyle]: sidebarState === 'floating',
|
||||
})}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user