From 2fa77fb38d014d92c1d9a3497718d5b294c290fe Mon Sep 17 00:00:00 2001 From: binamkayastha Date: Sun, 21 Jul 2024 00:44:24 -0400 Subject: [PATCH] Hotfix: Fix streak not updating This piece of code was lost during a git merge --- nepalingo-web/src/pages/FlashcardPage.tsx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nepalingo-web/src/pages/FlashcardPage.tsx b/nepalingo-web/src/pages/FlashcardPage.tsx index 8d12fd9..e1f4fe0 100644 --- a/nepalingo-web/src/pages/FlashcardPage.tsx +++ b/nepalingo-web/src/pages/FlashcardPage.tsx @@ -1,14 +1,23 @@ import Flashcard from "@/components/Flashcard"; import Header from "@/components/header/Header"; -import React from "react"; +import React, { useEffect } from "react"; +import { useStreak } from "@/hooks/StreakContext"; import ReactGA from "react-ga4"; const FlashcardPage: React.FC = () => { + const { updateStreak } = useStreak(); + ReactGA.send({ hitType: "pageview", page: window.location.pathname, title: "flashcard page", }); + + useEffect(() => { + updateStreak(); // Trigger streak update on flashcard page load + console.log("Updated Streak"); + }, []); + return ( <>