Skip to content

Commit 1aab1d2

Browse files
bmartelAndrejOros
andauthored
fix: OPTIC-1982: Allow any errors to be displayed inline for external connection testing (#7442)
Co-authored-by: AndrejOros <[email protected]>
1 parent 6b57a06 commit 1aab1d2

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

web/apps/labelstudio/src/components/Form/Form.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ export default class Form extends React.Component {
245245

246246
this.setState({ lastResponse: response });
247247

248-
if (response === null) {
248+
if (!response?.$meta?.ok) {
249249
this.props.onError?.();
250250
return false;
251251
}

web/apps/labelstudio/src/pages/Settings/StorageSettings/StorageForm.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const StorageForm = forwardRef(({ onSubmit, target, project, rootClass, s
7070
body,
7171
});
7272

73-
if (response !== null) setConnectionValid(true);
73+
if (response?.$meta?.ok) setConnectionValid(true);
7474
else setConnectionValid(false);
7575
}
7676
setChecking(false);

web/apps/labelstudio/src/providers/ApiProvider.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -226,9 +226,12 @@ export const ApiProvider = forwardRef<ApiContextType, PropsWithChildren<any>>(({
226226
}
227227
}
228228

229-
if (shouldShowGlobalError && suppressError !== true) {
229+
// Allow inline error handling
230+
if (suppressError !== true) {
230231
setError(result);
232+
}
231233

234+
if (shouldShowGlobalError && suppressError !== true) {
232235
let displayErrorToast: ErrorDisplayMessage | undefined;
233236

234237
// If there are no validation errors, show a toast error

0 commit comments

Comments
 (0)