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 <tukon479@gmail.com>
This commit is contained in:
parent
68b8a65429
commit
65249b45c7
|
|
@ -69,6 +69,7 @@ const AIEnhancedTimelineLayoutImpl = () => {
|
|||
|
||||
const layoutContainerRef = useRef<HTMLDivElement>(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<HTMLDivElement>) => {
|
||||
|
|
@ -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 (
|
||||
|
|
|
|||
Loading…
Reference in New Issue