Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

Commit

Permalink
Merge pull request backstage#3614 from backstage/freben/master-fix
Browse files Browse the repository at this point in the history
cost-insights: fix react-hooks/exhaustive-deps error
  • Loading branch information
freben authored Dec 8, 2020
2 parents 1e50e1f + 90458fe commit faa7be4
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 faa7be4

Please sign in to comment.