mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-14 02:55:54 +08:00
fix: window size changed causes result regeneration (#1908)
This commit is contained in:
parent
a938e1f184
commit
891218615e
@ -374,7 +374,13 @@ const TextGeneration: FC<IMainProps> = ({
|
|||||||
}
|
}
|
||||||
}, [siteInfo?.title, canReplaceLogo])
|
}, [siteInfo?.title, canReplaceLogo])
|
||||||
|
|
||||||
const [isShowResSidebar, { setTrue: showResSidebar, setFalse: hideResSidebar }] = useBoolean(false)
|
const [isShowResSidebar, { setTrue: doShowResSidebar, setFalse: hideResSidebar }] = useBoolean(false)
|
||||||
|
const showResSidebar = () => {
|
||||||
|
// fix: useClickAway hideResSidebar will close sidebar
|
||||||
|
setTimeout(() => {
|
||||||
|
doShowResSidebar()
|
||||||
|
}, 0)
|
||||||
|
}
|
||||||
const resRef = useRef<HTMLDivElement>(null)
|
const resRef = useRef<HTMLDivElement>(null)
|
||||||
useClickAway(() => {
|
useClickAway(() => {
|
||||||
hideResSidebar()
|
hideResSidebar()
|
||||||
@ -406,6 +412,16 @@ const TextGeneration: FC<IMainProps> = ({
|
|||||||
return (showTaskList.map(task => renderRes(task)))
|
return (showTaskList.map(task => renderRes(task)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const resWrapClassNames = (() => {
|
||||||
|
if (isPC)
|
||||||
|
return 'grow h-full'
|
||||||
|
|
||||||
|
if (!isShowResSidebar)
|
||||||
|
return 'none'
|
||||||
|
|
||||||
|
return cn('fixed z-50 inset-0', isTablet ? 'pl-[128px]' : 'pl-6')
|
||||||
|
})()
|
||||||
|
|
||||||
const renderResWrap = (
|
const renderResWrap = (
|
||||||
<div
|
<div
|
||||||
ref={resRef}
|
ref={resRef}
|
||||||
@ -578,22 +594,14 @@ const TextGeneration: FC<IMainProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Result */}
|
{/* Result */}
|
||||||
{isPC && (
|
<div
|
||||||
<div className='grow h-full'>
|
className={resWrapClassNames}
|
||||||
{renderResWrap}
|
style={{
|
||||||
</div>
|
background: (!isPC && isShowResSidebar) ? 'rgba(35, 56, 118, 0.2)' : 'none',
|
||||||
)}
|
}}
|
||||||
|
>
|
||||||
{(!isPC && isShowResSidebar) && (
|
{renderResWrap}
|
||||||
<div
|
</div>
|
||||||
className={cn('fixed z-50 inset-0', isTablet ? 'pl-[128px]' : 'pl-6')}
|
|
||||||
style={{
|
|
||||||
background: 'rgba(35, 56, 118, 0.2)',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
{renderResWrap}
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user