fix(sqllab): Invalid schema fetch for deprecated value (#22695)

This commit is contained in:
JUST.in DO IT
2023-01-19 09:19:17 -08:00
committed by GitHub
parent 577ac81686
commit d591cc8082
8 changed files with 207 additions and 20 deletions

View File

@@ -128,10 +128,22 @@ export function getUpToDateQuery(rootState, queryEditor, key) {
sqlLab: { unsavedQueryEditor },
} = rootState;
const id = key ?? queryEditor.id;
return {
const updatedQueryEditor = {
...queryEditor,
...(id === unsavedQueryEditor.id && unsavedQueryEditor),
};
if (
'schema' in updatedQueryEditor &&
!updatedQueryEditor.schemaOptions?.find(
({ value }) => value === updatedQueryEditor.schema,
)
) {
// remove the deprecated schema option
delete updatedQueryEditor.schema;
}
return updatedQueryEditor;
}
export function resetState() {