verdier opened a new pull request, #45003:
URL: https://github.com/apache/superset/pull/45003

   ### SUMMARY
   
   Explore shows "Keep control settings?" or "No form settings were maintained" 
whenever the dataset of the exploration changes. It picks the variant from 
`controlsTransferred`, the column and metric controls that its own reducer 
carried over in `UPDATE_FORM_DATA_BY_DATASOURCE`.
   
   Some chart plugins switch the dataset from one of their own controls. For 
example, a map whose panel starts from a business dataset and then queries a 
geometry dataset. Such a panel carries its settings over itself, right after 
`changeDatasource`. Those writes come after the reducer ran, so 
`controlsTransferred` is empty. The user always sees the warning variant and is 
told that nothing was kept, right after everything was.
   
   This PR adds an options argument: `changeDatasource(datasource, { silent: 
true })`. The option rides on `UPDATE_FORM_DATA_BY_DATASOURCE`, which is the 
action that swaps the dataset in the explore state, so it lands in the same 
state update. The reducer records it as `silentDatasourceChange`, and the 
alert's effect in `ControlPanelsContainer` skips that change. The flag is per 
call, not per chart: the dataset menu and every other existing caller pass no 
option and keep the alert. The SQL Lab exemption is unchanged.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   Before: after a plugin-driven dataset switch, the "No form settings were 
maintained" warning sits on top of the Data tab. After: no alert for a `silent` 
switch. The dataset menu still alerts.
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   cd superset-frontend
   npm run test -- src/explore/components/ControlPanelsContainer.test.tsx
   ```
   
   The two new tests dispatch `changeDatasource` on a store-backed Explore: 
without options the alert shows, and with `{ silent: true }` it does not.
   
   Manually: change the dataset from the dataset menu of any chart. The alert 
shows as before.
   
   ### 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))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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]

Reply via email to