mirror of
https://github.com/langgenius/dify.git
synced 2026-03-21 06:18:27 +08:00
fix(skill): add key prop to editors to fix content sync on tab switch
Lexical editor only uses initialConfig.editorState on mount, ignoring
subsequent value prop changes when the component is reused by React.
Adding key={activeTabId} forces React to remount editors when switching
tabs, ensuring correct content is displayed.
This commit is contained in:
@ -164,6 +164,7 @@ const SkillDocEditor: FC = () => {
|
||||
)}
|
||||
{isCodeOrText && (
|
||||
<CodeFileEditor
|
||||
key={activeTabId}
|
||||
language={language}
|
||||
theme={isMounted ? theme : 'default-theme'}
|
||||
value={currentContent}
|
||||
|
||||
Reference in New Issue
Block a user