Skip to content

Commit

Permalink
remove buggy useEffect
Browse files Browse the repository at this point in the history
  • Loading branch information
juandjara committed Nov 13, 2023
1 parent 19733af commit 66fcdc0
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions app/components/post-details/PostEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { CollectionFile, ProjectConfig } from "@/lib/projects.server"
import { borderColor, buttonCN } from "@/lib/styles"
import { useLoaderData } from "@remix-run/react"
import { useEffect, useState } from "react"
import { useState } from "react"
import MarkdownEditor from "./markdown-editor/MarkdownEditor"
import MarkdownPreview from "./markdown-editor/MarkdownPreview"
import clsx from "clsx"
Expand All @@ -24,15 +24,9 @@ export default function PostEditor({
expanded: boolean
}) {
const { file } = useLoaderData<LoaderData>()
const [tempContent, setTempContent] = useState('')
const [tempContent, setTempContent] = useState(file.body || '')
const [preview, setPreview] = useState(false)

useEffect(() => {
if (file) {
setTempContent(file.body || '')
}
}, [file])

function handleChange(text: string) {
setTempContent(text)
onDraft()
Expand Down

0 comments on commit 66fcdc0

Please sign in to comment.