diff --git a/frontend/src/component/personalDashboard/FlagMetricsChart.tsx b/frontend/src/component/personalDashboard/FlagMetricsChart.tsx index 31f7ab284887..2647b346b103 100644 --- a/frontend/src/component/personalDashboard/FlagMetricsChart.tsx +++ b/frontend/src/component/personalDashboard/FlagMetricsChart.tsx @@ -97,7 +97,7 @@ const EmptyFlagMetricsChart = () => { const useMetricsEnvironments = (project: string, flagName: string) => { const [environment, setEnvironment] = useState(null); const { feature } = useFeature(project, flagName); - const activeEnvironments = feature.environments.map((env) => ({ + const activeEnvironments = (feature?.environments ?? []).map((env) => ({ name: env.name, type: env.type, })); @@ -215,7 +215,7 @@ export const PlaceholderFlagMetricsChartWithWrapper: React.FC<{ ); }; -export const FlagMetricsChart: FC<{ +const FlagMetricsChartInner: FC<{ flag: { name: string; project: string }; onArchive: () => void; }> = ({ flag, onArchive }) => { @@ -235,7 +235,7 @@ export const FlagMetricsChart: FC<{ return ( ); @@ -283,6 +283,24 @@ export const FlagMetricsChart: FC<{ ); }; +export const FlagMetricsChart: FC<{ + flag: { name: string; project: string }; + onArchive: () => void; +}> = (props) => { + const breakingNames = ['.', '..']; + if (breakingNames.includes(props.flag.name)) { + return ( + + + + ); + } + + return ; +}; + ChartJS.register( annotationPlugin, CategoryScale,