Skip to content

Commit

Permalink
fix: max update depth fix
Browse files Browse the repository at this point in the history
  • Loading branch information
9sneha-n committed Sep 28, 2024
1 parent 9a25539 commit 86089fa
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/webapp/pages/dashboard/usePerformanceOverview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,20 @@ export function usePerformanceOverview(): State {
const [order, setOrder] = useState<Order>();

useEffect(() => {
if (dataPerformanceOverview) {
if (dataPerformanceOverview.length && order) {
setDataPerformanceOverview(
(prevDataPerformanceOverview: PerformanceOverviewMetrics[]) => {
const newDataPerformanceOverview = _(prevDataPerformanceOverview)
.orderBy([
[
(dataPerformanceOverviewData: PerformanceOverviewMetrics) => {
const value =
dataPerformanceOverviewData[order?.name || "creationDate"];
return Number.isNaN(Number(value)) ? value : Number(value);
},
order?.direction || "asc",
item =>
Number.isNaN(Number(item[order.name]))
? item[order.name]
: Number(item[order.name]),
order.direction,
],
])
.value();
.toArray();

return newDataPerformanceOverview;
}
Expand Down

0 comments on commit 86089fa

Please sign in to comment.