mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-24 17:51:51 +02:00
Merge pull request #14110 from overleaf/jdt-editor-left-main-doc-refresh
fix: updating context with new root doc id GitOrigin-RevId: 87e803554efc20cce4404f4f0f4137ae7fe9c2aa
This commit is contained in:
committed by
Copybot
parent
1328b442c8
commit
f49616b4cf
@@ -12,7 +12,7 @@ export default function useRootDocId() {
|
||||
|
||||
const setRootDocIdFunc = useCallback(
|
||||
async (newRootDocId: ProjectSettings['rootDocId']) => {
|
||||
// rootDoc_id will be undefined on angular scope on initialisation
|
||||
// rootDocId will be undefined on angular scope on initialisation
|
||||
const allowUpdate =
|
||||
typeof rootDocId !== 'undefined' && permissionsLevel !== 'readOnly'
|
||||
|
||||
|
||||
@@ -15,13 +15,17 @@ export default function useSaveProjectSettings() {
|
||||
) => {
|
||||
if (projectSettings) {
|
||||
const currentSetting = projectSettings[key]
|
||||
|
||||
if (currentSetting !== newSetting) {
|
||||
await saveProjectSettings(projectId, {
|
||||
[key]: newSetting,
|
||||
})
|
||||
|
||||
setProjectSettings({ ...projectSettings, [key]: newSetting })
|
||||
// rootDocId is used in our tsx and our endpoint, but rootDoc_id is used in our project $scope, etc
|
||||
// as we use both namings in many files, and convert back and forth,
|
||||
// its complicated to seperate and choose one name for all usages
|
||||
// todo: make rootDocId or rootDoc_id consistent, and remove need for this/ other conversions
|
||||
const settingsKey = key === 'rootDocId' ? 'rootDoc_id' : key
|
||||
setProjectSettings({ ...projectSettings, [settingsKey]: newSetting })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user