Skip to content

Commit

Permalink
filter null/undefined tables
Browse files Browse the repository at this point in the history
  • Loading branch information
diegomedina248 committed Jul 14, 2022
1 parent 71f1d3b commit 74aece8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions superset-frontend/src/SqlLab/actions/sqlLab.js
Original file line number Diff line number Diff line change
Expand Up @@ -1215,9 +1215,10 @@ export function collapseTable(table) {

export function removeTables(tables) {
return function (dispatch) {
const tablesToRemove = tables?.filter(Boolean) ?? [];
const sync = isFeatureEnabled(FeatureFlag.SQLLAB_BACKEND_PERSISTENCE)
? Promise.all(
tables.map(table =>
tablesToRemove.map(table =>
SupersetClient.delete({
endpoint: encodeURI(`/tableschemaview/${table.id}`),
}),
Expand All @@ -1226,7 +1227,7 @@ export function removeTables(tables) {
: Promise.resolve();

return sync
.then(() => dispatch({ type: REMOVE_TABLES, tables }))
.then(() => dispatch({ type: REMOVE_TABLES, tables: tablesToRemove }))
.catch(() =>
dispatch(
addDangerToast(
Expand Down

0 comments on commit 74aece8

Please sign in to comment.