mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-29 17:07:57 +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}
|
onOpen={handleOpenChange}
|
||||||
onResizing={handleResizing}
|
onResizing={handleResizing}
|
||||||
onWidthChange={handleWidthChange}
|
onWidthChange={handleWidthChange}
|
||||||
|
unmountOnExit={false}
|
||||||
className={clsx(navWrapperStyle, {
|
className={clsx(navWrapperStyle, {
|
||||||
[hoverNavWrapperStyle]: sidebarState === 'floating',
|
[hoverNavWrapperStyle]: sidebarState === 'floating',
|
||||||
})}
|
})}
|
||||||
|
@ -19,9 +19,8 @@ export const SidebarSwitch = ({
|
|||||||
const preventHovering = useLiveData(appSidebarService.preventHovering$);
|
const preventHovering = useLiveData(appSidebarService.preventHovering$);
|
||||||
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
|
const timeoutRef = useRef<NodeJS.Timeout | null>(null);
|
||||||
const switchRef = useRef<HTMLDivElement>(null);
|
const switchRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
const handleMouseEnter = useCallback(() => {
|
const handleMouseEnter = useCallback(() => {
|
||||||
if (open || preventHovering) {
|
if (preventHovering || open) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
appSidebarService.setHovering(true);
|
appSidebarService.setHovering(true);
|
||||||
@ -32,6 +31,7 @@ export const SidebarSwitch = ({
|
|||||||
clearTimeout(timeoutRef.current);
|
clearTimeout(timeoutRef.current);
|
||||||
}
|
}
|
||||||
if (open) {
|
if (open) {
|
||||||
|
appSidebarService.setHovering(false);
|
||||||
timeoutRef.current = setTimeout(() => {
|
timeoutRef.current = setTimeout(() => {
|
||||||
appSidebarService.setPreventHovering(false);
|
appSidebarService.setPreventHovering(false);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
Loading…
Reference in New Issue
Block a user