Skip to content

Commit

Permalink
fix: reset code on new file creation
Browse files Browse the repository at this point in the history
  • Loading branch information
marespopa committed Jan 20, 2025
1 parent d23b901 commit ed34687
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions client/components/overview/OverviewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react'
import Container from '../container/Container.component'

import {
atom_code,
atom_description,
atom_notes,
atom_snippets,
Expand All @@ -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 = {
Expand All @@ -41,6 +43,7 @@ const OverviewPage = () => {
setDescription(RESET)
setSnippets(RESET)
setNotes(RESET)
setCode(RESET)
router.push('/overview#greeting')
}
}
Expand Down
4 changes: 3 additions & 1 deletion client/components/overview/OverviewSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -261,20 +261,22 @@ const OverviewSection = ({ handleReset }: Props) => {
<ButtonFontIcon
title="New Task"
action={() => {
setDescription('')
handleReset();
setIsPreview(false)
}}
>
<FaFile />
</ButtonFontIcon>
<TemplateSection
handleTemplateChange={(variant) => {
handleReset();
loadTemplate(variant)
setIsPreview(false)
}}
/>
<OpenFileSection
handleFileLoad={(name, content) => {
handleReset();
setFilename(name || 'task.md')
setDescription(content)
setIsPreview(false)
Expand Down

0 comments on commit ed34687

Please sign in to comment.