You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "yousoph (via GitHub)" <gi...@apache.org> on 2026/06/16 05:38:49 UTC
[PR] fix(oauth2): retrigger queries for unsaved charts and schema loading after OAuth2 redirect [superset]
yousoph opened a new pull request, #41101:
URL: https://github.com/apache/superset/pull/41101
### SUMMARY
After completing the DB OAuth2 dance, queries and schema loads were silently not retried in several contexts. This fixes two bugs in `OAuth2RedirectMessage.tsx`:
**Bug 1 — Schema loading (SQL Lab + dataset modal):**
`DatabaseSelector`, `TableSelector`, and `TableExploreTree` all pass `source="crud"` to `ErrorMessageWithStackTrace`. The `handleOAuthComplete` handler had no branch for `'crud'`, so after OAuth2 completed the function silently returned without triggering a schema refetch. Fixed by adding an `else if (source === 'crud')` branch that dispatches `api.util.invalidateTags([{ type: 'Schemas', id: 'LIST' }])` — any mounted `useSchemas` hook will automatically refetch.
**Bug 2 — Unsaved Explore chart queries:**
The `'explore'` branch was guarded with `&& chartId`, but for unsaved charts `state.explore.slice` is `null` → `chartId = undefined` → condition always false. Fixed by removing the guard and using `chartId ?? UNSAVED_CHART_ID` (the canonical constant from `explore/constants.ts`).
**Why dashboard charts work:** the `'dashboard'` branch has no guard and fires unconditionally.
### BEFORE/AFTER
| Scenario | Before | After |
|---|---|---|
| SQL Lab schema loading | ❌ silent no-op | ✅ refetches |
| Dataset creation modal schemas | ❌ silent no-op | ✅ refetches |
| Explore unsaved chart query | ❌ silent no-op | ✅ retriggers |
| Explore saved chart query | ✅ | ✅ (unchanged) |
| Dashboard chart query | ✅ | ✅ (unchanged) |
| SQL Lab query execution | ✅ | ✅ (unchanged) |
### TESTING INSTRUCTIONS
1. Create a DB connection that uses OAuth2
2. In SQL Lab, select that DB — you should see the "Authorization needed" banner
3. Complete the OAuth2 dance
4. **Expected:** Schemas populate automatically without manual refresh
5. Repeat from Explore with an unsaved chart — query should retrigger after OAuth2
Unit tests added to `OAuth2RedirectMessage.test.tsx` covering all three new/fixed cases.
Fixes [SC-110940](https://app.shortcut.com/preset/story/110940)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(oauth2): retrigger queries for unsaved charts and schema loading after OAuth2 redirect [superset]
Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida commented on code in PR #41101:
URL: https://github.com/apache/superset/pull/41101#discussion_r3437775710
##########
superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx:
##########
@@ -106,10 +108,12 @@ export function OAuth2RedirectMessage({
}
if (source === 'sqllab' && query) {
dispatch(reRunQuery(query));
- } else if (source === 'explore' && chartId) {
- dispatch(triggerQuery(true, chartId));
+ } else if (source === 'explore') {
+ dispatch(triggerQuery(true, chartId ?? UNSAVED_CHART_ID));
} else if (source === 'dashboard') {
dispatch(onRefresh(chartList.map(Number), true, 0, dashboardId));
+ } else if (source === 'crud') {
+ dispatch(api.util.invalidateTags([{ type: 'Schemas', id: 'LIST' }]));
Review Comment:
I think we need to address this, especially for DBs that allow changing the catalog in SQL Lab.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(oauth2): retrigger queries for unsaved charts and schema loading after OAuth2 redirect [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41101:
URL: https://github.com/apache/superset/pull/41101#discussion_r3438010899
##########
superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.test.tsx:
##########
@@ -101,8 +133,8 @@ const defaultProps = {
source: 'sqllab' as ErrorSource,
};
-const setup = (overrides = {}) => (
- <Provider store={mockStore}>
+const setup = (overrides = {}, store: any = mockStore) => (
Review Comment:
**Suggestion:** Replace the `any` type on the store parameter with a concrete Redux store type (or a narrow reusable test-store type) so the helper remains type-safe. [custom_rule]
**Severity Level:** Minor ⚠️
<details>
<summary><b>Why it matters? 🤔 </b></summary>
The file is TypeScript/TSX and the helper explicitly types the `store` parameter as `any`. This directly violates the rule requiring a concrete type, reusable existing type, or narrower generic instead of `any`.
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=f262f4d77572424da27bffe68699512d&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=f262f4d77572424da27bffe68699512d&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.test.tsx
**Line:** 136:136
**Comment:**
*Custom Rule: Replace the `any` type on the store parameter with a concrete Redux store type (or a narrow reusable test-store type) so the helper remains type-safe.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41101&comment_hash=e69d2c3674d03770c0de95c6be46be6c3e671964bfc3f3055f46337483ecfbe2&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41101&comment_hash=e69d2c3674d03770c0de95c6be46be6c3e671964bfc3f3055f46337483ecfbe2&reaction=dislike'>👎</a>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(oauth2): retrigger queries for unsaved charts and schema loading after OAuth2 redirect [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #41101:
URL: https://github.com/apache/superset/pull/41101#issuecomment-4715804736
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/41101?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 64.32%. Comparing base ([`7b4efac`](https://app.codecov.io/gh/apache/superset/commit/7b4efacbc2e68e2b740d880b8615cd631a72c06a?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`85a42f1`](https://app.codecov.io/gh/apache/superset/commit/85a42f1388c8365c83ba7e4f86091c0a7243d647?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #41101 +/- ##
=======================================
Coverage 64.32% 64.32%
=======================================
Files 2652 2652
Lines 144728 144730 +2
Branches 33384 33386 +2
=======================================
+ Hits 93090 93092 +2
Misses 49985 49985
Partials 1653 1653
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/41101/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [javascript](https://app.codecov.io/gh/apache/superset/pull/41101/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `68.46% <100.00%> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/41101?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(oauth2): retrigger queries for unsaved charts and schema loading after OAuth2 redirect [superset]
Posted by "yousoph (via GitHub)" <gi...@apache.org>.
yousoph commented on code in PR #41101:
URL: https://github.com/apache/superset/pull/41101#discussion_r3531708703
##########
superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.test.tsx:
##########
@@ -101,8 +133,8 @@ const defaultProps = {
source: 'sqllab' as ErrorSource,
};
-const setup = (overrides = {}) => (
- <Provider store={mockStore}>
+const setup = (overrides = {}, store: any = mockStore) => (
Review Comment:
Done in `cb3b46f` — `setup`'s `store` param is now typed as `Store` (imported from `redux`), which is exactly what `createStore` returns for `mockStore`. No more `any`.
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(oauth2): retrigger queries for unsaved charts and schema loading after OAuth2 redirect [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #41101:
URL: https://github.com/apache/superset/pull/41101#issuecomment-4744886941
### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | ace97c28f1025f0b527d693911b96e90cd2bc862 |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6a34357ead1e58000895c3ff |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-41101--superset-docs-preview.netlify.app](https://deploy-preview-41101--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
|<span aria-hidden="true">🤖</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#DcpBCoAgEADAv-w5wTLL-kHPMF1TqLRFoYj-nrc5zAuJ4pEyzAANrKRP46tduFnUJfuOXQXpYYSZwrYh1WUx7fFZbH2DFr2QI2rbolScczVJI5yD7wc) |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-41101--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(oauth2): retrigger queries for unsaved charts and schema loading after OAuth2 redirect [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41101:
URL: https://github.com/apache/superset/pull/41101#issuecomment-4746233449
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(oauth2): retrigger queries for unsaved charts and schema loading after OAuth2 redirect [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41101:
URL: https://github.com/apache/superset/pull/41101#issuecomment-4715341598
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(oauth2): retrigger queries for unsaved charts and schema loading after OAuth2 redirect [superset]
Posted by "yousoph (via GitHub)" <gi...@apache.org>.
yousoph merged PR #41101:
URL: https://github.com/apache/superset/pull/41101
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(oauth2): retrigger queries for unsaved charts and schema loading after OAuth2 redirect [superset]
Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on code in PR #41101:
URL: https://github.com/apache/superset/pull/41101#discussion_r3523796851
##########
superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx:
##########
@@ -106,10 +108,12 @@ export function OAuth2RedirectMessage({
}
if (source === 'sqllab' && query) {
dispatch(reRunQuery(query));
- } else if (source === 'explore' && chartId) {
- dispatch(triggerQuery(true, chartId));
+ } else if (source === 'explore') {
+ dispatch(triggerQuery(true, chartId ?? UNSAVED_CHART_ID));
Review Comment:
This is in now... the selector uses the same fallback chain as `getChartKey` (`slice_id`, then `form_data.slice_id`, then `UNSAVED_CHART_ID`).
##########
superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx:
##########
@@ -106,10 +108,12 @@ export function OAuth2RedirectMessage({
}
if (source === 'sqllab' && query) {
dispatch(reRunQuery(query));
- } else if (source === 'explore' && chartId) {
- dispatch(triggerQuery(true, chartId));
+ } else if (source === 'explore') {
+ dispatch(triggerQuery(true, chartId ?? UNSAVED_CHART_ID));
} else if (source === 'dashboard') {
dispatch(onRefresh(chartList.map(Number), true, 0, dashboardId));
+ } else if (source === 'crud') {
+ dispatch(api.util.invalidateTags([{ type: 'Schemas', id: 'LIST' }]));
Review Comment:
Done in the current diff... the crud branch invalidates `Catalogs` and `Tables` alongside `Schemas`, so all three refetch after the dance completes.
##########
superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.test.tsx:
##########
@@ -101,8 +133,8 @@ const defaultProps = {
source: 'sqllab' as ErrorSource,
};
-const setup = (overrides = {}) => (
- <Provider store={mockStore}>
+const setup = (overrides = {}, store: any = mockStore) => (
Review Comment:
This one's fair... we try to avoid `any` even in test helpers, and typing it as `Store` is a one-word fix. @yousoph mind flipping that when you get a chance?
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(oauth2): retrigger queries for unsaved charts and schema loading after OAuth2 redirect [superset]
Posted by "betodealmeida (via GitHub)" <gi...@apache.org>.
betodealmeida commented on code in PR #41101:
URL: https://github.com/apache/superset/pull/41101#discussion_r3437770319
##########
superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx:
##########
@@ -106,10 +108,12 @@ export function OAuth2RedirectMessage({
}
if (source === 'sqllab' && query) {
dispatch(reRunQuery(query));
- } else if (source === 'explore' && chartId) {
- dispatch(triggerQuery(true, chartId));
+ } else if (source === 'explore') {
+ dispatch(triggerQuery(true, chartId ?? UNSAVED_CHART_ID));
Review Comment:
This looks like a defensive nice-to-have, something like:
```js
const chartId = useSelector<ExplorePageState, number>(state =>
state.explore?.slice?.slice_id ?? state.explore?.form_data?.slice_id ?? UNSAVED_CHART_ID,
);
// then in handler: dispatch(triggerQuery(true, chartId));
```
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(oauth2): retrigger queries for unsaved charts and schema loading after OAuth2 redirect [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #41101:
URL: https://github.com/apache/superset/pull/41101#discussion_r3418401516
##########
superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx:
##########
@@ -106,10 +108,12 @@ export function OAuth2RedirectMessage({
}
if (source === 'sqllab' && query) {
dispatch(reRunQuery(query));
- } else if (source === 'explore' && chartId) {
- dispatch(triggerQuery(true, chartId));
+ } else if (source === 'explore') {
+ dispatch(triggerQuery(true, chartId ?? UNSAVED_CHART_ID));
} else if (source === 'dashboard') {
dispatch(onRefresh(chartList.map(Number), true, 0, dashboardId));
+ } else if (source === 'crud') {
+ dispatch(api.util.invalidateTags([{ type: 'Schemas', id: 'LIST' }]));
Review Comment:
**Suggestion:** The `crud` OAuth completion path invalidates only the `Schemas` tag, but `source="crud"` is also used by components that fail on catalog and table fetches. If OAuth2 redirect was triggered by `useCatalogs` or `useTables`, this branch will not retrigger those failed requests, so the UI can stay stuck until manual refresh. Invalidate the related `Catalogs` and `Tables` tags (or trigger the appropriate refetch action) in the same branch. [cache]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ OAuth2 catalog fetches stay failed until manual refresh.
- ❌ OAuth2 table fetches in TableSelector not auto-retried.
- ⚠️ SQL Lab table tree remains empty after OAuth completion.
```
</details>
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Configure a database that uses OAuth2 and open a UI that uses `DatabaseSelector` or
`TableSelector`, e.g. SQL Lab or dataset creation modal
(`superset-frontend/src/components/DatabaseSelector/index.tsx` and
`superset-frontend/src/components/TableSelector/index.tsx`).
2. In `DatabaseSelector`, a catalogs or schemas fetch is triggered via `useCatalogs` /
`useSchemas` (`catalogs.ts` / `schemas.ts`), and in `TableSelector` a tables fetch is
triggered via `useTables`
(`superset-frontend/src/components/TableSelector/index.tsx:11-32` with `useTables` from
`src/hooks/apiResources/tables.ts`); if the DB has no stored OAuth2 credentials, the
backend returns an `OAUTH2_REDIRECT` error, which is stored in `errorPayload` and rendered
by `<ErrorMessageWithStackTrace error={errorPayload} source="crud" />` (`DatabaseSelector`
and `TableSelector` renderError functions).
3. The `ErrorMessageWithStackTrace` component uses `OAuth2RedirectMessage` as the renderer
for `OAUTH2_REDIRECT` errors, passing `source="crud"`, so when the OAuth popup flow
completes it invokes `handleOAuthComplete` in
`superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx:104-117`, which
for `source === 'crud'` only dispatches `api.util.invalidateTags([{ type: 'Schemas', id:
'LIST' }]);`.
4. The failing requests for catalogs and tables are tagged with `Catalogs` and `Tables`
respectively (`superset-frontend/src/hooks/apiResources/catalogs.ts` uses `providesTags:
[{ type: 'Catalogs', id: 'LIST' }]`, and `tables.ts` uses `providesTags: ['Tables']`), so
invalidating only the `Schemas` tag does not cause `useCatalogs` or `useTables` queries to
refetch; after OAuth completes the catalogs/table dropdowns and SQL Lab table tree stay in
the same error state until the user manually clicks the respective refresh buttons wired
to `refetchCatalogs` / `refetch` / `handleRefreshTables`.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=b30999ef58664177a5fa331e4317dc83&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=b30999ef58664177a5fa331e4317dc83&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx
**Line:** 116:116
**Comment:**
*Cache: The `crud` OAuth completion path invalidates only the `Schemas` tag, but `source="crud"` is also used by components that fail on catalog and table fetches. If OAuth2 redirect was triggered by `useCatalogs` or `useTables`, this branch will not retrigger those failed requests, so the UI can stay stuck until manual refresh. Invalidate the related `Catalogs` and `Tables` tags (or trigger the appropriate refetch action) in the same branch.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41101&comment_hash=37d94cd73835df970df417905e97a64c813052231bf327bac90101c6f4333883&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41101&comment_hash=37d94cd73835df970df417905e97a64c813052231bf327bac90101c6f4333883&reaction=dislike'>👎</a>
##########
superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx:
##########
@@ -106,10 +108,12 @@ export function OAuth2RedirectMessage({
}
if (source === 'sqllab' && query) {
dispatch(reRunQuery(query));
- } else if (source === 'explore' && chartId) {
- dispatch(triggerQuery(true, chartId));
+ } else if (source === 'explore') {
+ dispatch(triggerQuery(true, chartId ?? UNSAVED_CHART_ID));
Review Comment:
**Suggestion:** Falling back directly to `UNSAVED_CHART_ID` can target chart key `0` even when the current Explore state still has a saved chart id in `form_data.slice_id` (a known state shape in Explore). That dispatches `triggerQuery` for the wrong chart key and can silently fail to retrigger the intended saved chart query; derive the key using the same chart-key logic used elsewhere in Explore (slice id, then form_data id, then unsaved fallback). [incorrect variable usage]
<details>
<summary><b>Severity Level:</b> Major ⚠️</summary>
```mdx
- ❌ Explore OAuth retry may dispatch for wrong chart key.
- ⚠️ Saved chart queries may not rerun after OAuth.
- ⚠️ Users must manually rerun saved charts to recover.
```
</details>
<details>
<summary><b>Steps of Reproduction ✅ </b></summary>
```mdx
1. Open Explore on a saved chart so that Explore state has `form_data.slice_id` set but
(in some state transitions) `explore.slice` is null, a shape explicitly supported by
`getChartKey` in `superset-frontend/src/explore/exploreUtils/index.ts:14-17` (`return
slice?.slice_id ?? form_data?.slice_id ?? UNSAVED_CHART_ID;`).
2. Run a query against an OAuth2-protected database from Explore; if credentials are
missing, the backend raises an `OAUTH2_REDIRECT` error, which Explore renders through
`ErrorMessageWithStackTrace` using `source="explore"`, wiring into `OAuth2RedirectMessage`
(`superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx:66-72`).
3. Complete the OAuth2 flow in the popup; the BroadcastChannel/storage listener invokes
`handleOAuthComplete` in `OAuth2RedirectMessage.tsx:104-117`, and for `source ===
'explore'` it dispatches `triggerQuery(true, chartId ?? UNSAVED_CHART_ID)` where `chartId`
comes from `useSelector(state => state.explore?.slice?.slice_id)` (`lines 89-92`), which
is `undefined` when `slice` is absent, so it falls back to `UNSAVED_CHART_ID` (0).
4. The chart reducer and `ChartContainer` use the canonical chart key from `getChartKey`
(preferring `slice.slice_id` then `form_data.slice_id`), so in this state the active chart
entry is keyed by `form_data.slice_id`, not 0; dispatching `triggerQuery` with
`UNSAVED_CHART_ID` therefore targets a different or non-existent chart, leaving the
intended saved chart query not retriggered automatically after OAuth and requiring the
user to manually rerun the query.
```
</details>
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=b24f9cd763ff4426a7f8b50e5c588a95&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=b24f9cd763ff4426a7f8b50e5c588a95&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
*(Use Cmd/Ctrl + Click for best experience)*
<details>
<summary><b>Prompt for AI Agent 🤖 </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset-frontend/src/components/ErrorMessage/OAuth2RedirectMessage.tsx
**Line:** 112:112
**Comment:**
*Incorrect Variable Usage: Falling back directly to `UNSAVED_CHART_ID` can target chart key `0` even when the current Explore state still has a saved chart id in `form_data.slice_id` (a known state shape in Explore). That dispatches `triggerQuery` for the wrong chart key and can silently fail to retrigger the intended saved chart query; derive the key using the same chart-key logic used elsewhere in Explore (slice id, then form_data id, then unsaved fallback).
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41101&comment_hash=082e693a01361374742d8e0d18511207438549dfe4ec83c7f6d446a17a9ddd8d&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F41101&comment_hash=082e693a01361374742d8e0d18511207438549dfe4ec83c7f6d446a17a9ddd8d&reaction=dislike'>👎</a>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(oauth2): retrigger queries for unsaved charts and schema loading after OAuth2 redirect [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41101:
URL: https://github.com/apache/superset/pull/41101#issuecomment-4717524252
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(oauth2): retrigger queries for unsaved charts and schema loading after OAuth2 redirect [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #41101:
URL: https://github.com/apache/superset/pull/41101#issuecomment-4898411477
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
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: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org