From 65249b45c73ee17f297f9bd030ecfb9fa6495b74 Mon Sep 17 00:00:00 2001 From: Innei Date: Mon, 27 Oct 2025 23:16:59 +0800 Subject: [PATCH] fix: should render entry content when refresh page - Added a new effect to manage the rendering of the details column based on the timeline's state. - Updated dependencies in the width adjustment effect to ensure proper layout updates. - Cleaned up unnecessary state updates to enhance performance. Signed-off-by: Innei --- .../AIEnhancedTimelineLayout.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/desktop/layer/renderer/src/modules/app-layout/ai-enhanced-timeline/AIEnhancedTimelineLayout.tsx b/apps/desktop/layer/renderer/src/modules/app-layout/ai-enhanced-timeline/AIEnhancedTimelineLayout.tsx index f2def5f70..a7fa27491 100644 --- a/apps/desktop/layer/renderer/src/modules/app-layout/ai-enhanced-timeline/AIEnhancedTimelineLayout.tsx +++ b/apps/desktop/layer/renderer/src/modules/app-layout/ai-enhanced-timeline/AIEnhancedTimelineLayout.tsx @@ -69,6 +69,7 @@ const AIEnhancedTimelineLayoutImpl = () => { const layoutContainerRef = useRef(null) const hasMountedRef = useRef(false) + // Delay the details column until the timeline width animation finishes const [shouldRenderDetailsColumn, setShouldRenderDetailsColumn] = useState(showEntryDetailsColumn) const feedColumnWidth = useUISettingKey("feedColWidth") @@ -158,7 +159,7 @@ const AIEnhancedTimelineLayoutImpl = () => { setAiPanelWidth(width) // Trigger layout update window.dispatchEvent(new Event("resize")) - }, [resolvePreferredWidth]) + }, [resolvePreferredWidth, setAiPanelWidth]) const handleTimelineTransitionEnd = useCallback( (event: TransitionEvent) => { @@ -174,15 +175,18 @@ const AIEnhancedTimelineLayoutImpl = () => { [showEntryDetailsColumn], ) + useEffect(() => { + if (!showEntryDetailsColumn) { + setShouldRenderDetailsColumn(false) + } + }, [showEntryDetailsColumn]) + useEffect(() => { if (!hasMountedRef.current) { hasMountedRef.current = true setShouldRenderDetailsColumn(showEntryDetailsColumn) return } - - // Defer rendering until the width transition signals completion - setShouldRenderDetailsColumn(false) }, [showEntryDetailsColumn]) return (