Set permissionsLevel to readOnly when out of sync (#18391)

GitOrigin-RevId: d495d7ba4d5d0c7db00277538c932a585f6dace0
This commit is contained in:
Alf Eaton
2024-05-21 08:04:31 +00:00
committed by Copybot
parent e7827fbd57
commit af721874f1
2 changed files with 12 additions and 1 deletions
@@ -31,6 +31,7 @@ import { EditorType } from '@/features/ide-react/editor/types/editor-type'
import { DocId } from '../../../../../types/project-settings'
import { Update } from '@/features/history/services/types/update'
import { useDebugDiffTracker } from '../hooks/use-debug-diff-tracker'
import { useEditorContext } from '@/shared/context/editor-context'
interface GotoOffsetOptions {
gotoOffset: number
@@ -93,6 +94,7 @@ export const EditorManagerProvider: FC = ({ children }) => {
const ide = useIdeContext()
const { projectId } = useIdeReactContext()
const { reportError, eventEmitter, eventLog } = useIdeReactContext()
const { setOutOfSync } = useEditorContext()
const { socket, disconnect, connectionState } = useConnectionContext()
const { view, setView } = useLayoutContext()
const { showGenericMessageModal, genericModalVisible, showOutOfSyncModal } =
@@ -566,6 +568,9 @@ export const EditorManagerProvider: FC = ({ children }) => {
// Tell the user about the error state.
setIsInErrorState(true)
// Ensure that the editor is locked
setOutOfSync(true)
// Display the "out of sync" modal
showOutOfSyncModal(editorContent || '')
// Do not forceReopen the document.
@@ -592,6 +597,7 @@ export const EditorManagerProvider: FC = ({ children }) => {
setIsInErrorState,
showGenericMessageModal,
showOutOfSyncModal,
setOutOfSync,
t,
])