diff --git a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/Postgres_Spec.js b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/Postgres_Spec.js index 09c84f0bf3..a4ce8d0f3c 100644 --- a/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/Postgres_Spec.js +++ b/app/client/cypress/integration/Smoke_TestSuite/ServerSideTests/QueryPane/Postgres_Spec.js @@ -331,7 +331,17 @@ describe("Validate CRUD queries for Postgres along with UI flow verifications", cy.deleteQueryUsingContext(); }); - it("12. Deletes the datasource", () => { + it("12. Bug 14493: The application is breaking when user runs the query with result as empty array", function() { + cy.NavigateToActiveDSQueryPane(datasourceName); + cy.get(queryLocators.templateMenu).click({ force: true }); + cy.typeValueNValidate( + "select * from public.users where name='Ayush1234' ORDER BY id LIMIT 10", + ); + cy.runQuery(); + cy.deleteQueryUsingContext(); + }); + + it("13. Deletes the datasource", () => { cy.NavigateToQueryEditor(); cy.NavigateToActiveTab(); cy.contains(".t--datasource-name", datasourceName).click({ force: true }); diff --git a/app/client/src/pages/Editor/QueryEditor/Table.tsx b/app/client/src/pages/Editor/QueryEditor/Table.tsx index 4490fa8b8a..816bf09e76 100644 --- a/app/client/src/pages/Editor/QueryEditor/Table.tsx +++ b/app/client/src/pages/Editor/QueryEditor/Table.tsx @@ -202,7 +202,7 @@ function Table(props: TableProps) { const data = React.useMemo(() => { const emptyString = ""; /* Check for length greater than 0 of rows returned from the query for mappings keys */ - if (isArray(props.data)) { + if (!!props.data && isArray(props.data) && props.data.length > 0) { const keys = Object.keys(props.data[0]); keys.forEach((key) => { if (key === emptyString) {