Improve handling of undefined root doc id in settings (#28108)

GitOrigin-RevId: ba0c5b468b11c53440506f05af0550e55e0f3a23
This commit is contained in:
Alf Eaton
2025-08-26 15:46:29 +01:00
committed by Copybot
parent c18d2935df
commit 52ca103f46
2 changed files with 3 additions and 5 deletions

View File

@@ -12,9 +12,7 @@ export default function useRootDocId() {
const setRootDocIdFunc = useCallback(
async (newRootDocId: ProjectSettings['rootDocId']) => {
// rootDocId will be undefined on angular scope on initialisation
const allowUpdate =
typeof rootDocId !== 'undefined' && permissionsLevel !== 'readOnly'
const allowUpdate = permissionsLevel !== 'readOnly'
if (allowUpdate) {
try {
@@ -24,7 +22,7 @@ export default function useRootDocId() {
}
}
},
[permissionsLevel, rootDocId, saveProjectSettings]
[permissionsLevel, saveProjectSettings]
)
return {

View File

@@ -43,7 +43,7 @@ export default function RootDocumentSetting() {
disabled={!write}
options={validDocsOptions}
onChange={setRootDocId}
value={rootDocId}
value={rootDocId ?? ''}
translateOptions="no"
/>
)