Fix quickstart default checked of conditional fields [ci skip]

This commit is contained in:
Ines Montani 2021-05-03 11:48:12 +10:00 committed by svlandeg
parent ffaa0d6b9b
commit 62a01956c3
2 changed files with 5 additions and 2 deletions

View File

@ -105,12 +105,13 @@ const Quickstart = ({
multiple, multiple,
other, other,
help, help,
hidden,
}) => { }) => {
// Optional function that's called with the value // Optional function that's called with the value
const setterFunc = setters[id] || (() => {}) const setterFunc = setters[id] || (() => {})
// Check if dropdown should be shown // Check if dropdown should be shown
const dropdownGetter = showDropdown[id] || (() => true) const dropdownGetter = showDropdown[id] || (() => true)
return ( return hidden ? null : (
<div key={id} data-quickstart-group={id} className={classes.group}> <div key={id} data-quickstart-group={id} className={classes.group}>
<style data-quickstart-style={id} scoped> <style data-quickstart-style={id} scoped>
{styles[id] || {styles[id] ||

View File

@ -115,7 +115,9 @@ export default function QuickstartTraining({ id, title, download = 'base_config.
})) }))
.sort((a, b) => a.title.localeCompare(b.title)) .sort((a, b) => a.title.localeCompare(b.title))
if (!_components.includes('textcat')) { if (!_components.includes('textcat')) {
data = data.filter(({ id }) => id !== 'textcat') data = data.map(field =>
field.id === 'textcat' ? { ...field, hidden: true } : field
)
} }
return ( return (
<Quickstart <Quickstart