You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/06/28 09:08:39 UTC
[GitHub] [superset] simcha90 commented on a change in pull request #15411: fix(native-filters): show human readable time grain label in indicator
simcha90 commented on a change in pull request #15411:
URL: https://github.com/apache/superset/pull/15411#discussion_r659612418
##########
File path: superset-frontend/src/filters/components/TimeGrain/TimeGrainFilterPlugin.tsx
##########
@@ -52,10 +52,22 @@ export default function PluginFilterTimegrain(
const { defaultValue, inputRef } = formData;
const [value, setValue] = useState<string[]>(defaultValue ?? []);
+ const durationMap = useMemo(
+ () =>
+ data.reduce((agg, row) => {
+ const { duration, name } = row as { duration: string; name: string };
+ return {
+ ...agg,
+ [duration]: name,
+ };
+ }, {} as { [key in string]: string }),
+ [JSON.stringify(data)],
Review comment:
may be simplify:
```
data.reduce((agg, row) => ({
...agg,
[row.duration]: row.name
}), {} as { [key in string]: string }),
```
--
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