Skip to content

Commit

Permalink
cost-insights: fix react-hooks/exhaustive-deps error
Browse files Browse the repository at this point in the history
  • Loading branch information
freben committed Dec 8, 2020
1 parent 1e50e1f commit 90458fe
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/friendly-news-know.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@backstage/plugin-cost-insights': patch
---

fix react-hooks/exhaustive-deps error
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@ export const ProductInsightsChart = ({
const layoutClasses = useLayoutStyles();

// Only a single entities Record for the root product entity is supported
const entityLabel = assertAlways(findAnyKey(entity.entities));
const entities = entity.entities[entityLabel] ?? [];
const entities = useMemo(() => {
const entityLabel = assertAlways(findAnyKey(entity.entities));
return entity.entities[entityLabel] ?? [];
}, [entity]);

const [activeLabel, setActive] = useState<Maybe<string>>();
const [selectLabel, setSelected] = useState<Maybe<string>>();
Expand Down

0 comments on commit 90458fe

Please sign in to comment.