Skip to content

Commit 9b41a21

Browse files
committed
Don't actively pop-up errors unless editors are read-only
The previous code tried to do this, but wrongly - by checking for readOnly at mount time (when it's never set) instead of checking the current state (which changes as we switch from request to breakpoint etc).
1 parent d5b0423 commit 9b41a21

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

src/components/editor/base-editor.tsx

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -271,19 +271,17 @@ export class BaseEditor extends React.Component<EditorProps> {
271271
// any. Mostly relevant to OpenAPI body validation issues. We can't do this in reset or
272272
// elsewhere, as markers update slightly asynchronously from content changes, so this is
273273
// only visible by observing modelMarkers.
274-
if (this.props.options?.readOnly) {
275-
disposeOnUnmount(this, reaction(() => ({
276-
markers: (this.modelUri && modelsMarkers.get(this.modelUri)) ?? []
277-
}), ({ markers }) => {
278-
if (markers.length) {
279-
requestAnimationFrame(() => { // Run after the reset marker.close() update
280-
this.withoutFocusingEditor(() => {
281-
this.getMarkerController().showAtMarker(markers[0]);
282-
});
274+
disposeOnUnmount(this, reaction(() => ({
275+
markers: (this.modelUri && modelsMarkers.get(this.modelUri)) ?? []
276+
}), ({ markers }) => {
277+
if (markers.length && this.props.options?.readOnly) {
278+
requestAnimationFrame(() => { // Run after the reset marker.close() update
279+
this.withoutFocusingEditor(() => {
280+
this.getMarkerController().showAtMarker(markers[0]);
283281
});
284-
}
285-
}, { equals: comparer.structural }));
286-
}
282+
});
283+
}
284+
}, { equals: comparer.structural }));
287285
}
288286

289287
componentDidMount() {

0 commit comments

Comments
 (0)