From aba9b1395b8b4883ffb3350ac7ea949cef9219c6 Mon Sep 17 00:00:00 2001 From: echo Date: Thu, 12 Mar 2026 17:06:10 +0100 Subject: [PATCH] fitness goals on home screen update fix --- apps/mobile/src/app/(tabs)/index.tsx | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/apps/mobile/src/app/(tabs)/index.tsx b/apps/mobile/src/app/(tabs)/index.tsx index d630d89..dfb3dbe 100644 --- a/apps/mobile/src/app/(tabs)/index.tsx +++ b/apps/mobile/src/app/(tabs)/index.tsx @@ -44,7 +44,7 @@ export default function HomeScreen() { const { colors, typography } = useTheme(); const { refetchStatistics, forceRefresh, statistics, loading } = useStatistics(); - const { goals } = useFitnessGoals(); + const { goals, refetchGoals } = useFitnessGoals(); const [refreshing, setRefreshing] = useState(false); const [trackMealModalVisible, setTrackMealModalVisible] = useState(false); const [addWaterModalVisible, setAddWaterModalVisible] = useState(false); @@ -57,18 +57,19 @@ export default function HomeScreen() { const caloriesBounce = useRef(new Animated.Value(1)).current; const waterBounce = useRef(new Animated.Value(1)).current; - // Refetch statistics when screen comes into focus + // Refetch statistics and goals when screen comes into focus useFocusEffect( useCallback(() => { refetchStatistics(); - }, [refetchStatistics]), + refetchGoals(); + }, [refetchStatistics, refetchGoals]), ); const onRefresh = useCallback(async () => { setRefreshing(true); - await forceRefresh(); + await Promise.all([forceRefresh(), refetchGoals()]); setRefreshing(false); - }, [forceRefresh]); + }, [forceRefresh, refetchGoals]); const getGreeting = () => { const hour = new Date().getHours();