From cb3237c51c9b9a1f3a4da3371e2ff69dfb0b04ef Mon Sep 17 00:00:00 2001 From: adueck Date: Tue, 11 Oct 2022 15:41:14 +0500 Subject: [PATCH] mm --- src/components/ChapterFeedback.tsx | 35 +++++++++++++++++------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/components/ChapterFeedback.tsx b/src/components/ChapterFeedback.tsx index a7a3a24..a51630e 100644 --- a/src/components/ChapterFeedback.tsx +++ b/src/components/ChapterFeedback.tsx @@ -17,21 +17,26 @@ function ChapterFeedback({ chapter }: { chapter: string }) { function handleRatingClick(v: number) { setRating(o => o === v ? undefined : v); } - useEffect(() => { - return () => { - if (rating === undefined || feedbackStatus === "sent") return; - fetch("https://account.lingdocs.com/feedback", { - method: "PUT", - credentials: "include", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ feedback: "", rating }), - }).catch(() => { - console.error("couldn't send chapter feedback"); - }); - } - }, []); + // automatic sending of emoji click feedback if someone leaves the chapter without + // filling in and sending the feedback textbox + // not doing this yet because not sure if it's a clean setup like "componentWillUnmount" + // or if it unecessarily unmounts and re-renders + // useEffect(() => { + // return () => { + // if (rating === undefined || feedbackStatus === "sent") return; + // fetch("https://account.lingdocs.com/feedback", { + // method: "PUT", + // credentials: "include", + // headers: { + // "Content-Type": "application/json", + // }, + // body: JSON.stringify({ feedback: "", rating }), + // }).catch(() => { + // console.error("couldn't send chapter feedback"); + // }); + // } + // // eslint-disable-next-line + // }, []); function handleSendFeedback() { const toSend = { chapter,