fix(LOY-136): rewards are no longer invalidated and refetched when redeeming rewards, instead it happens when modal is closed

This commit is contained in:
Christian Andolf
2025-02-11 14:52:48 +01:00
parent cd1ca159dc
commit 4832688254
2 changed files with 10 additions and 5 deletions
@@ -10,8 +10,11 @@ import {
} from "react-aria-components"
import { useIntl } from "react-intl"
import { trpc } from "@/lib/trpc/client"
import { CloseLargeIcon } from "@/components/Icons"
import Button from "@/components/TempDesignSystem/Button"
import useLang from "@/hooks/useLang"
import Campaign from "./Flows/Campaign"
import Tier from "./Flows/Tier"
@@ -32,6 +35,8 @@ const MotionModal = motion(Modal)
export default function Redeem({ reward, membershipNumber }: RedeemProps) {
const [animation, setAnimation] = useState<RedeemModalState>("unmounted")
const intl = useIntl()
const lang = useLang()
const utils = trpc.useUtils()
const [redeemStep, setRedeemStep] = useState<RedeemStep>("initial")
function modalStateHandler(newAnimationState: RedeemModalState) {
@@ -74,7 +79,10 @@ export default function Redeem({ reward, membershipNumber }: RedeemProps) {
<>
<header className={styles.modalHeader}>
<button
onClick={close}
onClick={() => {
utils.contentstack.rewards.current.invalidate({ lang })
close()
}}
type="button"
className={styles.modalClose}
>