+
diff --git a/packages/dashboard-v2/src/components/CurrentUsage/UsageGraph.js b/packages/dashboard-v2/src/components/CurrentUsage/UsageGraph.js
index 3f6f23c2..de4e7e46 100644
--- a/packages/dashboard-v2/src/components/CurrentUsage/UsageGraph.js
+++ b/packages/dashboard-v2/src/components/CurrentUsage/UsageGraph.js
@@ -1,9 +1,11 @@
import styled from "styled-components";
+import usageGraphBg from "../../../static/images/usage-graph-bg.svg";
+
export const UsageGraph = styled.div.attrs({
className: "w-full my-3 grid grid-flow-row grid-rows-2",
})`
height: 146px;
- background: url(/images/usage-graph-bg.svg) no-repeat;
+ background: url(${usageGraphBg}) no-repeat;
background-size: cover;
`;
diff --git a/packages/dashboard-v2/src/contexts/plans/PlansProvider.js b/packages/dashboard-v2/src/contexts/plans/PlansProvider.js
index 135c9bcb..7c6579ad 100644
--- a/packages/dashboard-v2/src/contexts/plans/PlansProvider.js
+++ b/packages/dashboard-v2/src/contexts/plans/PlansProvider.js
@@ -19,7 +19,14 @@ const aggregatePlansAndLimits = (plans, limits, { includeFreePlan }) => {
// Decorate each plan with its corresponding limits data, if available.
if (limits?.length) {
- return sortedPlans.map((plan) => ({ ...plan, limits: limits[plan.tier] || null }));
+ return limits.map((limitsDescriptor, index) => {
+ const asssociatedPlan = sortedPlans.find((plan) => plan.tier === index) || {};
+
+ return {
+ ...asssociatedPlan,
+ limits: limitsDescriptor || null,
+ };
+ });
}
// If we don't have the limits data yet, set just return the plans.
@@ -40,10 +47,12 @@ export const PlansProvider = ({ children }) => {
if (plansError || limitsError) {
setLoading(false);
setError(plansError || limitsError);
- } else if (rawPlans) {
+ } else if (rawPlans || limits) {
setLoading(false);
setPlans(
- aggregatePlansAndLimits(rawPlans, limits?.userLimits, { includeFreePlan: !settings.isSubscriptionRequired })
+ aggregatePlansAndLimits(rawPlans || [], limits?.userLimits, {
+ includeFreePlan: !settings.isSubscriptionRequired,
+ })
);
}
}, [rawPlans, limits, plansError, limitsError, settings.isSubscriptionRequired]);
diff --git a/packages/dashboard-v2/src/hooks/useActivePlan.js b/packages/dashboard-v2/src/hooks/useActivePlan.js
index de71a036..e843f510 100644
--- a/packages/dashboard-v2/src/hooks/useActivePlan.js
+++ b/packages/dashboard-v2/src/hooks/useActivePlan.js
@@ -10,6 +10,7 @@ export default function useActivePlan(user) {
useEffect(() => {
if (user) {
+ console.log("setActivePlan");
setActivePlan(plans.find((plan) => plan.tier === user.tier));
}
}, [plans, user]);