Skip to content

Commit a4d2f20

Browse files
authored
Chore: Release 11.1.1 (#3854)
* fix: request body input focus issue (#3849) * fix: request body not shown when first loaded
1 parent 5039a7b commit a4d2f20

6 files changed

Lines changed: 44 additions & 15 deletions

File tree

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "11.1.0"
2+
".": "11.1.1"
33
}

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
## [11.1.1](https://github.com/microsoftgraph/microsoft-graph-explorer-v4/compare/v11.1.0...v11.1.1) (2025-05-14)
6+
7+
8+
### Bug Fixes
9+
10+
* request body input focus issue ([#3849](https://github.com/microsoftgraph/microsoft-graph-explorer-v4/issues/3849)) ([4d663e2](https://github.com/microsoftgraph/microsoft-graph-explorer-v4/commit/4d663e2ab8cdc7cc4b0323e2de458a4065abdb53))
11+
512
## [11.1.0](https://github.com/microsoftgraph/microsoft-graph-explorer-v4/compare/v11.0.0...v11.1.0) (2025-04-28)
613

714

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "graph-explorer-v2",
3-
"version": "11.1.0",
3+
"version": "11.1.1",
44
"private": true,
55
"dependencies": {
66
"@augloop/types-core": "file:packages/types-core-2.16.189.tgz",

sonar-project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ sonar.projectKey=microsoftgraph_microsoft-graph-explorer-v4
22
sonar.organization=microsoftgraph2
33
sonar.projectName=microsoft-graph-explorer-v4
44
// x-release-please-start-version
5-
sonar.projectVersion=11.1.0
5+
sonar.projectVersion=11.1.1
66
// x-release-please-end
77
sonar.host.url=https://sonarcloud.io
88

src/app/views/common/monaco/Monaco.tsx

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useEffect, useRef } from 'react';
1+
import { useEffect, useMemo, useRef, useState } from 'react';
22
import { makeStyles } from '@fluentui/react-components';
33
import { Editor, OnChange } from '@monaco-editor/react';
44
import { editor } from 'monaco-editor';
@@ -32,6 +32,7 @@ const useStyles = makeStyles({
3232
const Monaco = ({ body, onChange, language, readOnly, extraInfoElement, isVisible }: MonacoProps) => {
3333
const styles = useStyles();
3434
const editorRef = useRef<editor.IStandaloneCodeEditor | null>(null);
35+
const [isEditorReady, setEditorReady] = useState(false);
3536

3637
const editorOptions: editor.IStandaloneEditorConstructionOptions = {
3738
lineNumbers: 'off',
@@ -48,12 +49,15 @@ const Monaco = ({ body, onChange, language, readOnly, extraInfoElement, isVisibl
4849
wordSeparators: '"'
4950
};
5051

51-
let formattedBody: string | undefined;
52-
if (typeof body === 'string') {
53-
formattedBody = body;
54-
} else if (body) {
55-
formattedBody = formatJsonStringForAllBrowsers(body);
56-
}
52+
const formattedBody = useMemo(() => {
53+
if (typeof body === 'string') {
54+
return body;
55+
}
56+
if (body) {
57+
return formatJsonStringForAllBrowsers(body);
58+
}
59+
return '';
60+
}, [body]);
5761

5862
// Recalculate layout when the tab becomes visible
5963
useEffect(() => {
@@ -62,23 +66,41 @@ const Monaco = ({ body, onChange, language, readOnly, extraInfoElement, isVisibl
6266
}
6367
}, [isVisible]);
6468

69+
// Update editor content without resetting cursor
70+
useEffect(() => {
71+
if (editorRef.current && isEditorReady) {
72+
const currentValue = editorRef.current.getValue();
73+
if (formattedBody !== currentValue) {
74+
const model = editorRef.current.getModel();
75+
if (model) {
76+
editorRef.current.pushUndoStop();
77+
model.pushEditOperations(
78+
[],
79+
[{ range: model.getFullModelRange(), text: formattedBody ?? '' }],
80+
() => null
81+
);
82+
}
83+
}
84+
}
85+
}, [formattedBody, isEditorReady]);
86+
6587
return (
6688
<ThemeContext.Consumer>
6789
{(theme) => (
68-
<div id=' monaco-editor' className={styles.container}>
90+
<div id='monaco-editor' className={styles.container}>
6991
{extraInfoElement}
7092
<Editor
71-
key={formattedBody}
7293
language={language || 'json'}
7394
width='100%'
7495
height='100%'
75-
value={formattedBody}
7696
options={editorOptions}
7797
onChange={onChange}
7898
theme={theme === 'light' ? 'vs' : 'vs-dark'}
7999
onMount={(editorInstance) => {
80100
editorRef.current = editorInstance;
81101
editorInstance.layout();
102+
editorInstance.setValue(formattedBody ?? '');
103+
setEditorReady(true);
82104
}}
83105
/>
84106
</div>

0 commit comments

Comments
 (0)