mirror of https://github.com/langgenius/dify.git
fix: Update breadcrumb click handling to close dropdown and adjust prefix slicing logic
This commit is contained in:
parent
e911a4e719
commit
073a0974a4
|
|
@ -25,6 +25,11 @@ const Dropdown = ({
|
|||
setOpen(prev => !prev)
|
||||
}, [])
|
||||
|
||||
const handleBreadCrumbClick = useCallback((index: number) => {
|
||||
onBreadcrumbClick(index)
|
||||
setOpen(false)
|
||||
}, [onBreadcrumbClick])
|
||||
|
||||
return (
|
||||
<PortalToFollowElem
|
||||
open={open}
|
||||
|
|
@ -50,7 +55,7 @@ const Dropdown = ({
|
|||
<Menu
|
||||
breadcrumbs={breadcrumbs}
|
||||
startIndex={startIndex}
|
||||
onBreadcrumbClick={onBreadcrumbClick}
|
||||
onBreadcrumbClick={handleBreadCrumbClick}
|
||||
/>
|
||||
</PortalToFollowElemContent>
|
||||
<span className='system-xs-regular text-divider-deep'>/</span>
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ const Breadcrumbs = ({
|
|||
|
||||
const handleClickBreadcrumb = useCallback((index: number) => {
|
||||
const { setFileList, setSelectedFileList, setPrefix } = dataSourceStore.getState()
|
||||
const newPrefix = prefix.slice(0, index - 1)
|
||||
const newPrefix = prefix.slice(0, index + 1)
|
||||
setFileList([])
|
||||
setSelectedFileList([])
|
||||
setPrefix(newPrefix)
|
||||
|
|
|
|||
Loading…
Reference in New Issue