diff --git a/src/components/config/VisualConfigEditor.tsx b/src/components/config/VisualConfigEditor.tsx index ce2d1783..8b90ee43 100644 --- a/src/components/config/VisualConfigEditor.tsx +++ b/src/components/config/VisualConfigEditor.tsx @@ -262,8 +262,12 @@ export function VisualConfigEditor({ if (mode !== 'full' || !jumpRequest || handledJumpRef.current === jumpRequest) return; handledJumpRef.current = jumpRequest; // handle each request once, even if deps re-fire const { fieldId, sectionId } = jumpRequest; + const targetFieldId = + (fieldId === 'tlsCert' || fieldId === 'tlsKey') && !values.tlsEnable + ? 'tlsEnable' + : fieldId; - const el = document.getElementById(configFieldDomId(fieldId)); + const el = document.getElementById(configFieldDomId(targetFieldId)); if (!el) { // Field not rendered right now (e.g. TLS cert while TLS is disabled) — fall back to // bringing its section into view horizontally. @@ -300,7 +304,7 @@ export function VisualConfigEditor({ highlightTimerRef.current = null; highlightedElRef.current = null; }, 1800); - }, [mode, jumpRequest]); + }, [mode, jumpRequest, values.tlsEnable]); // Clear the highlight timer on unmount. useEffect( @@ -481,6 +485,7 @@ export function VisualConfigEditor({ (Object.keys(validationErrors ?? {}) as VisualConfigFieldPath[]).some( (field) => field !== 'port' && Boolean(validationErrors?.[field]) ) || hasPayloadValidationErrors; + const payloadValidationKey = hasPayloadValidationErrors ? 'payload-errors' : 'payload-ok'; const activeSection = sections.find((section) => section.id === activeSectionId) ?? sections[0]; useEffect(() => { @@ -1725,6 +1730,7 @@ export function VisualConfigEditor({ ) { - const detailsProps = - open !== undefined ? { open } : { defaultOpen }; + const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen); + const resolvedOpen = open ?? uncontrolledOpen; const cls = [styles.root, className].filter(Boolean).join(' '); const contentCls = flush ? styles.contentFlush : styles.content; + return ( -
+
{ + if (open === undefined) { + setUncontrolledOpen(event.currentTarget.open); + } + onToggle?.(event); + }} + {...rest} + > {label}