villebro opened a new pull request, #20107: URL: https://github.com/apache/superset/pull/20107
### SUMMARY After enabling the `GENERIC_CHART_AXES` feature flag, timeseries charts that were created before enabling the flag won't render in Explore due to the required x-axis control being unset. This PR checks if the feature flag is enabled, and sets the default value of the x-axis control to the value of the `granularity_sqla` flag if the value of the x-axis control is unset. To accomplish this, the default control values need to be mapped twice - the first pass applies the defaults for controls that have a simple default value (=not a callback). After the first pass, the defaults are applied again, this time with the control panel state, so that controls that need to reference other controls values can do that. Previously the default value callback never received the control panel state, as it wasn't available during the initial state population. ### AFTER Now the timeseries chart that was saved before the feature flag was enabled opens up correctly: https://user-images.githubusercontent.com/33317356/169009593-9a494ef1-6f52-483d-a1c3-2f91df433886.mp4 ### BEFORE Previously, the chart would not render, as the required x-axis control was unset in the chart form data: https://user-images.githubusercontent.com/33317356/169009759-044e4a77-3936-4990-beef-aa2edf1bb212.mp4 ### TESTING INSTRUCTIONS 1. Create a Chart using the Time - Series Bar Chart V2. 2. Add it to a Dashboard. 3. Enable the GENERIC_CHART_AXES FF. 4. Access the Dashboard - note that the Chart is still working. 5. Click on "Edit Chart" and notice how the chart no longer renders in Explore <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [ ] Has associated issue: - [ ] Required feature flags: - [ ] 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 - [ ] 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]
