fix(sql-lab): recover from Cannot convert object to primitive value issue

A `Cannot convert object to primitive value` error appears in the developer console when trying to format the data coming from Presto. This issue causes the SQL Lab to crash. This can be sorted by stringifying the row data.
This commit is contained in:
Victor Arbues 2022-03-30 12:53:33 +01:00 committed by GitHub
parent fa35109bf2
commit 357e359e5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -103,7 +103,13 @@ export function prepareCopyToClipboardTabularData(data, columns) {
row[j] = data[i][parseFloat(key)];
}
}
result += `${Object.values(row).join('\t')}\n`;
try {
result += `${Object.values(row).join('\t')}\n`;
catch {
result += `${Object.values(row)
.map(value => JSON.stringify(value))
.join('\t')}\n`;
}
}
return result;
}