From ed346875d10fcfe09fa99fd9a1a5be6b57eeb7e6 Mon Sep 17 00:00:00 2001 From: marespopa Date: Mon, 20 Jan 2025 18:46:12 +0200 Subject: [PATCH] fix: reset code on new file creation --- client/components/overview/OverviewPage.tsx | 3 +++ client/components/overview/OverviewSection.tsx | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/client/components/overview/OverviewPage.tsx b/client/components/overview/OverviewPage.tsx index 021d1da..93e0405 100644 --- a/client/components/overview/OverviewPage.tsx +++ b/client/components/overview/OverviewPage.tsx @@ -3,6 +3,7 @@ import React from 'react' import Container from '../container/Container.component' import { + atom_code, atom_description, atom_notes, atom_snippets, @@ -23,6 +24,7 @@ const OverviewPage = () => { const [, setDescription] = useAtom(atom_description) const [, setSnippets] = useAtom(atom_snippets) const [, setNotes] = useAtom(atom_notes) + const [, setCode] = useAtom(atom_code) const router = useRouter() const sectionProps = { @@ -41,6 +43,7 @@ const OverviewPage = () => { setDescription(RESET) setSnippets(RESET) setNotes(RESET) + setCode(RESET) router.push('/overview#greeting') } } diff --git a/client/components/overview/OverviewSection.tsx b/client/components/overview/OverviewSection.tsx index d43e463..88c8c6f 100644 --- a/client/components/overview/OverviewSection.tsx +++ b/client/components/overview/OverviewSection.tsx @@ -261,7 +261,7 @@ const OverviewSection = ({ handleReset }: Props) => { { - setDescription('') + handleReset(); setIsPreview(false) }} > @@ -269,12 +269,14 @@ const OverviewSection = ({ handleReset }: Props) => { { + handleReset(); loadTemplate(variant) setIsPreview(false) }} /> { + handleReset(); setFilename(name || 'task.md') setDescription(content) setIsPreview(false)