Add "None" option to "Main document" menu when no root doc is set (#18102)

GitOrigin-RevId: 5e1cd6bcbf070d7b6a92a1fcd69370361a3e6d3e
This commit is contained in:
Alf Eaton 2024-04-25 13:01:15 +01:00 committed by Copybot
parent ede03daafd
commit cb97bb5170

View file

@ -24,6 +24,14 @@ export default function SettingsDocument() {
label: doc.path, label: doc.path,
})) }))
if (!rootDocId) {
mappedDocs.unshift({
value: '',
label: 'None',
disabled: true,
})
}
return mappedDocs return mappedDocs
}, [docs, rootDocId]) }, [docs, rootDocId])
@ -34,7 +42,7 @@ export default function SettingsDocument() {
return ( return (
<SettingsMenuSelect <SettingsMenuSelect
onChange={setRootDocId} onChange={setRootDocId}
value={rootDocId} value={rootDocId ?? ''}
options={validDocsOptions} options={validDocsOptions}
label={t('main_document')} label={t('main_document')}
name="rootDocId" name="rootDocId"