fix(sqllab): null database with backend persistence (#19548)

This commit is contained in:
Ville Brofeldt
2022-04-06 12:32:41 +03:00
committed by GitHub
parent 2de5e6fac4
commit 2d81c4c79f
2 changed files with 17 additions and 6 deletions

View File

@@ -1393,10 +1393,21 @@ export function queryEditorSetFunctionNames(queryEditor, dbId) {
functionNames: json.function_names,
}),
)
.catch(() =>
dispatch(
addDangerToast(t('An error occurred while fetching function names.')),
),
);
.catch(err => {
if (err.status === 404) {
// for databases that have been deleted, just reset the function names
dispatch({
type: QUERY_EDITOR_SET_FUNCTION_NAMES,
queryEditor,
functionNames: [],
});
} else {
dispatch(
addDangerToast(
t('An error occurred while fetching function names.'),
),
);
}
});
};
}