sadpandajoe commented on code in PR #40000:
URL: https://github.com/apache/superset/pull/40000#discussion_r3343443282
##########
superset-frontend/src/chartCustomizations/components/TimeGrain/TimeGrainFilterPlugin.tsx:
##########
@@ -111,15 +111,22 @@ export default function PluginFilterTimegrain(
);
}
- const options = (data || []).map(
- (row: { name: string; duration: string }) => {
+ const options = (data || [])
+ .map((row: { name: string; duration: string }) => {
const { name, duration } = row;
return {
label: name,
value: duration,
};
- },
- );
+ })
+ // Apply allowlist filter if time_grains is configured, but keep current
selection visible
+ .filter(option => {
+ const allowlist = formData.time_grains;
+ if (!allowlist || allowlist.length === 0) {
+ return true;
+ }
+ return allowlist.includes(option.value) || value.includes(option.value);
+ });
Review Comment:
Can we add a regression test for this portion of the 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: [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]