Skip to content

Commit b393ea9

Browse files
committed
fix(skills): re-seed Content editor when initialValues changes
Bump the field's remount key in the reset guard so the seed-once rich editor re-seeds when content is reset from a changed initialValues (same skill id keeps the React key otherwise stable), keeping the editor and saved value in sync.
1 parent 000ad6f commit b393ea9

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

  • apps/sim/app/workspace/[workspaceId]/skills/components/skill-modal

apps/sim/app/workspace/[workspaceId]/skills/components/skill-modal/skill-modal.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ export function SkillModal({
6565
const [name, setName] = useState('')
6666
const [description, setDescription] = useState('')
6767
const [content, setContent] = useState('')
68-
// Bumped to remount the rich Content editor when content is set programmatically (a pasted
69-
// SKILL.md is destructured into the fields) — the editor otherwise only seeds on mount.
68+
// Bumped to remount the seed-once rich Content editor whenever `content` is set programmatically
69+
// a reset from a changed `initialValues` or a destructured SKILL.md paste — so the editor re-seeds.
7070
const [contentSeed, setContentSeed] = useState(0)
7171
const [errors, setErrors] = useState<FieldErrors>({})
7272
const [saving, setSaving] = useState(false)
@@ -80,6 +80,9 @@ export function SkillModal({
8080
setContent(initialValues?.content ?? '')
8181
setErrors({})
8282
setActiveTab('create')
83+
// Remount the seed-once Content editor so it re-seeds from the reset value (an `initialValues`
84+
// change for the same skill keeps the React key otherwise stable).
85+
setContentSeed((seed) => seed + 1)
8386
}
8487
if (open !== prevOpen) setPrevOpen(open)
8588
if (initialValues !== prevInitialValues) setPrevInitialValues(initialValues)

0 commit comments

Comments
 (0)