bito-code-review[bot] commented on PR #45003:
URL: https://github.com/apache/superset/pull/45003#issuecomment-6011409031
<!-- Bito Reply -->
The flagged issue is correct: the current implementation only prevents the
*opening* of a new dataset-change alert, but it does not close or hide an alert
that is already visible. To resolve this, you should ensure that the alert
state is explicitly cleared or closed when `skipDatasetChangeAlert` is true.
In `superset-frontend/src/explore/components/ControlPanelsContainer.tsx`,
you can update the `useEffect` hook to handle the closing of the alert:
```tsx
useEffect(() => {
if (
prevDatasource &&
prevDatasource.type !== DatasourceType.Query &&
(props.exploreState.datasource?.id !== prevDatasource.id ||
props.exploreState.datasource?.type !== prevDatasource.type)
) {
if (props.exploreState.skipDatasetChangeAlert) {
// Logic to close/hide the existing alert goes here
} else {
// Logic to open the alert
}
}
}, [props.exploreState.datasource?.id,
props.exploreState.datasource?.type, props.exploreState.skipDatasetChangeAlert,
prevDatasource]);
```
Would you like me to fetch all other comments on this PR to validate them
and implement fixes for those as well?
**superset-frontend/src/explore/components/ControlPanelsContainer.tsx**
```
useEffect(() => {
if (
prevDatasource &&
prevDatasource.type !== DatasourceType.Query &&
(props.exploreState.datasource?.id !== prevDatasource.id ||
props.exploreState.datasource?.type !== prevDatasource.type)
) {
if (props.exploreState.skipDatasetChangeAlert) {
// Logic to close/hide the existing alert goes here
} else {
// Logic to open the alert
}
}
}, [props.exploreState.datasource?.id,
props.exploreState.datasource?.type, props.exploreState.skipDatasetChangeAlert,
prevDatasource]);
```
--
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]