diff --git a/.github/workflows/codeflash-benchmarks.yml b/.github/workflows/cf-webapp-quality-gates.yml similarity index 100% rename from .github/workflows/codeflash-benchmarks.yml rename to .github/workflows/cf-webapp-quality-gates.yml diff --git a/js/cf-webapp/src/components/dashboard/sidebar.tsx b/js/cf-webapp/src/components/dashboard/sidebar.tsx index 8ce0a8928..23aa1ef48 100644 --- a/js/cf-webapp/src/components/dashboard/sidebar.tsx +++ b/js/cf-webapp/src/components/dashboard/sidebar.tsx @@ -106,8 +106,10 @@ export function Sidebar({ className, user, isLoading, error }: SidebarProps): JS if (subscriptionFetchRef.current) return subscriptionFetchRef.current = true + let cancelled = false getCurrentUserSubscriptionData() .then(data => { + if (cancelled) return if (data) { setSubscription({ optimizations_used: data.optimizations_used || 0, @@ -117,10 +119,14 @@ export function Sidebar({ className, user, isLoading, error }: SidebarProps): JS setSubscription(null) } }) - .catch(() => setSubscription(null)) - .finally(() => { - subscriptionFetchRef.current = false + .catch(() => { + if (!cancelled) setSubscription(null) }) + + return () => { + cancelled = true + subscriptionFetchRef.current = false + } }, [mode]) const toggleTheme = () => {