sadpandajoe opened a new pull request, #42322: URL: https://github.com/apache/superset/pull/42322
### SUMMARY When a SQL Lab query fails, the error message was rendered **twice** in the results panel. **Root cause:** For asynchronous query failures, the same error ends up in two places on the query object: - `superset-frontend/src/SqlLab/components/QueryAutoRefresh/index.tsx:115` dispatches `refreshQueries(...)`, and the `REFRESH_QUERIES` reducer (`superset-frontend/src/SqlLab/reducers/sqlLab.ts:760`) merges the poll payload — including `extra.errors` — into the query. - Immediately after, the same component dispatches `queryFailed(query, ..., query.extra?.errors)` (`QueryAutoRefresh/index.tsx:123`), and the `QUERY_FAILED` reducer (`reducers/sqlLab.ts:450`) stores that same array as `query.errors`. `ResultSet` then rendered the concatenation of both arrays at `superset-frontend/src/SqlLab/components/ResultSet/index.tsx:621`: ```ts const errors = [...(query.extra?.errors || []), ...(query.errors || [])]; ``` Because `query.extra.errors` and `query.errors` hold the identical error, each error was rendered twice by the `errors.map(...)` below it. **Fix:** Deduplicate the concatenated array with `uniqWith(..., isEqual)` so an error present in both sources is shown exactly once. This is the single render site that covers both the sync and async failure paths, so it also guards against any future double-source. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF _Skipped — behavior is covered by a unit test._ ### TESTING INSTRUCTIONS 1. Run an async (`allow_run_async`) SQL Lab query that fails (e.g. reference a non-existent column). 2. Before: the database error is displayed twice. After: it is displayed once. Automated: `superset-frontend/src/SqlLab/components/ResultSet/ResultSet.test.tsx` adds a test asserting a single `error-message` when the same error is present in both `errors` and `extra.errors`. The test fails on the unpatched code (renders 2) and passes with the fix. ``` Tests: 37 passed, 37 total ``` ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [ ] Required feature flags: - [x] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Introduces new feature or API - [ ] Removes existing feature or API Fixes sc-114990 https://app.shortcut.com/preset/story/114990 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
