mirror of
https://github.com/langgenius/dify.git
synced 2026-04-26 05:35:58 +08:00
perf: Replace topOffset prop with withHeader in Panel component
This commit is contained in:
@ -76,7 +76,7 @@ const SubGraphChildren: FC<SubGraphChildrenProps> = ({
|
||||
|
||||
return (
|
||||
<Panel
|
||||
topOffset={0}
|
||||
withHeader={false}
|
||||
components={{
|
||||
right: panelRight,
|
||||
}}
|
||||
|
||||
@ -7,7 +7,6 @@ import { memo, useEffect, useMemo } from 'react'
|
||||
import WorkflowWithDefaultContext from '@/app/components/workflow'
|
||||
import { NODE_WIDTH_X_OFFSET, START_INITIAL_POSITION } from '@/app/components/workflow/constants'
|
||||
import { WorkflowContextProvider } from '@/app/components/workflow/context'
|
||||
import { useHooksStore } from '@/app/components/workflow/hooks-store'
|
||||
import { useStore } from '@/app/components/workflow/store'
|
||||
import { BlockEnum, EditionType, isPromptMessageContext, PromptRole } from '@/app/components/workflow/types'
|
||||
import SubGraphMain from './components/sub-graph-main'
|
||||
@ -42,12 +41,12 @@ const SubGraphContent: FC<SubGraphProps> = (props) => {
|
||||
toolParamValue,
|
||||
parentAvailableNodes,
|
||||
parentAvailableVars,
|
||||
configsMap,
|
||||
onSave,
|
||||
} = props
|
||||
|
||||
const setParentAvailableVars = useStore(state => state.setParentAvailableVars)
|
||||
const setParentAvailableNodes = useStore(state => state.setParentAvailableNodes)
|
||||
const configsMap = useHooksStore(state => state.configsMap)
|
||||
|
||||
useEffect(() => {
|
||||
setParentAvailableVars?.(parentAvailableVars || [])
|
||||
|
||||
@ -19,7 +19,7 @@ export type PanelProps = {
|
||||
right?: React.ReactNode
|
||||
}
|
||||
versionHistoryPanelProps?: VersionHistoryPanelProps
|
||||
topOffset?: number
|
||||
withHeader?: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
@ -70,7 +70,7 @@ const useResizeObserver = (
|
||||
const Panel: FC<PanelProps> = ({
|
||||
components,
|
||||
versionHistoryPanelProps,
|
||||
topOffset,
|
||||
withHeader = true,
|
||||
}) => {
|
||||
const selectedNode = useReactflow(useShallow((s) => {
|
||||
const nodes = s.getNodes()
|
||||
@ -129,8 +129,10 @@ const Panel: FC<PanelProps> = ({
|
||||
<div
|
||||
ref={rightPanelRef}
|
||||
tabIndex={-1}
|
||||
className={cn('absolute bottom-1 right-0 top-14 z-10 flex outline-none')}
|
||||
style={topOffset === undefined ? undefined : { top: `${topOffset}px` }}
|
||||
className={cn(
|
||||
'absolute bottom-1 right-0 z-10 flex outline-none',
|
||||
withHeader ? 'top-14' : 'top-0',
|
||||
)}
|
||||
key={`${isRestoring}`}
|
||||
>
|
||||
{components?.left}
|
||||
|
||||
Reference in New Issue
Block a user