mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-30 20:31:34 +02:00
Improve handling of undefined root doc id in settings (#28108)
GitOrigin-RevId: ba0c5b468b11c53440506f05af0550e55e0f3a23
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -43,7 +43,7 @@ export default function RootDocumentSetting() {
|
||||
disabled={!write}
|
||||
options={validDocsOptions}
|
||||
onChange={setRootDocId}
|
||||
value={rootDocId}
|
||||
value={rootDocId ?? ''}
|
||||
translateOptions="no"
|
||||
/>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user