From d9f54f7c96df5d8bb6fdba6f8a332676eb0e2e67 Mon Sep 17 00:00:00 2001 From: escobarjonatan Date: Thu, 28 Mar 2024 00:14:41 -0500 Subject: [PATCH] STUD-203: Reset consentsToContract field to false when navigating back (#575) --- .../src/pages/home/uploadSong/ConfirmAgreement.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/studio/src/pages/home/uploadSong/ConfirmAgreement.tsx b/apps/studio/src/pages/home/uploadSong/ConfirmAgreement.tsx index 5ef3bdfe..eaccf441 100644 --- a/apps/studio/src/pages/home/uploadSong/ConfirmAgreement.tsx +++ b/apps/studio/src/pages/home/uploadSong/ConfirmAgreement.tsx @@ -2,7 +2,7 @@ import { useFormikContext } from "formik"; import { Box, useTheme } from "@mui/material"; import { useWindowDimensions } from "@newm-web/utils"; import { Button, Typography } from "@newm-web/elements"; -import { FunctionComponent, useState } from "react"; +import { FunctionComponent, useEffect, useState } from "react"; import PriceSummaryDialog from "./PriceSummaryDialog"; import { UploadSongThunkRequest } from "../../../modules/song"; import { ConfirmContract } from "../../../components"; @@ -32,6 +32,13 @@ const ConfirmAgreement: FunctionComponent = ({ } }; + // Reset consent to contract when unmounting + useEffect(() => { + return () => { + setFieldValue("consentsToContract", false); + }; + }, [setFieldValue]); + return (