diff --git a/webapp/packages/plugin-sql-editor/src/SqlDataSource/BaseSqlDataSource.ts b/webapp/packages/plugin-sql-editor/src/SqlDataSource/BaseSqlDataSource.ts index e9dd014a93..bcf54266d4 100644 --- a/webapp/packages/plugin-sql-editor/src/SqlDataSource/BaseSqlDataSource.ts +++ b/webapp/packages/plugin-sql-editor/src/SqlDataSource/BaseSqlDataSource.ts @@ -239,10 +239,10 @@ export abstract class BaseSqlDataSource implements ISqlDataSource { const scriptLength = this.script.length; - this.innerCursorState = { + this.innerCursorState = Object.freeze({ begin: Math.min(begin, scriptLength), end: Math.min(end, scriptLength), - }; + }); this.onUpdate.execute(); } diff --git a/webapp/packages/plugin-sql-editor/src/SqlEditor/useSqlEditor.ts b/webapp/packages/plugin-sql-editor/src/SqlEditor/useSqlEditor.ts index 5b8b6fd043..23361e73ff 100644 --- a/webapp/packages/plugin-sql-editor/src/SqlEditor/useSqlEditor.ts +++ b/webapp/packages/plugin-sql-editor/src/SqlEditor/useSqlEditor.ts @@ -5,7 +5,7 @@ * Licensed under the Apache License, Version 2.0. * you may not use this file except in compliance with the License. */ -import { action, autorun, computed, IReactionDisposer, observable, untracked } from 'mobx'; +import { action, autorun, computed, IReactionDisposer, observable, runInAction, untracked } from 'mobx'; import { useEffect } from 'react'; import { ConfirmationDialog, useExecutor, useObservableRef } from '@cloudbeaver/core-blocks'; @@ -538,7 +538,7 @@ export function useSqlEditor(state: ISqlEditorTabState): ISQLEditorData { const contexts = data.onMode.execute(data); const activeSegmentMode = contexts.getContext(SQLEditorModeContext); - action(() => { + runInAction(() => { data.activeSegmentMode = activeSegmentMode; }); });