mirror of
https://github.com/langgenius/dify.git
synced 2026-05-05 09:58:04 +08:00
chore: refact tool and filepreveiw context to zustand to reduce rerender
This commit is contained in:
@ -333,6 +333,10 @@ const PromptEditorContent: FC<PromptEditorContentProps> = ({
|
||||
}
|
||||
}, [availableNodes, nodeId, onToolMetadataChange, toolMetadata, workflowVariableBlock?.variables])
|
||||
|
||||
const filePreviewContextValue = React.useMemo(() => ({
|
||||
enabled: Boolean(isSupportSandbox),
|
||||
}), [isSupportSandbox])
|
||||
|
||||
const sandboxPlaceHolder = React.useMemo(() => {
|
||||
if (!isSupportSandbox)
|
||||
return null
|
||||
@ -387,7 +391,7 @@ const PromptEditorContent: FC<PromptEditorContentProps> = ({
|
||||
return (
|
||||
<LexicalComposer initialConfig={{ ...initialConfig, editable }}>
|
||||
<ToolBlockContextProvider value={toolBlockContextValue}>
|
||||
<FilePreviewContextProvider value={{ enabled: Boolean(isSupportSandbox) }}>
|
||||
<FilePreviewContextProvider value={filePreviewContextValue}>
|
||||
<div
|
||||
className={cn('relative', wrapperClassName)}
|
||||
data-skill-editor-root={isSupportSandbox ? 'true' : undefined}
|
||||
|
||||
Reference in New Issue
Block a user