Browse Source

fix: 🐛

imwald
codytseng 8 months ago
parent
commit
71b6418dfa
  1. 5
      src/components/PostEditor/PostContent.tsx

5
src/components/PostEditor/PostContent.tsx

@ -8,6 +8,7 @@ import {
} from '@/lib/draft-event' } from '@/lib/draft-event'
import { isTouchDevice } from '@/lib/utils' import { isTouchDevice } from '@/lib/utils'
import { useNostr } from '@/providers/NostrProvider' import { useNostr } from '@/providers/NostrProvider'
import { useReply } from '@/providers/ReplyProvider'
import postEditorCache from '@/services/post-editor-cache.service' import postEditorCache from '@/services/post-editor-cache.service'
import { TPollCreateData } from '@/types' import { TPollCreateData } from '@/types'
import { ImageUp, ListTodo, LoaderCircle, Settings, Smile } from 'lucide-react' import { ImageUp, ListTodo, LoaderCircle, Settings, Smile } from 'lucide-react'
@ -35,6 +36,7 @@ export default function PostContent({
}) { }) {
const { t } = useTranslation() const { t } = useTranslation()
const { pubkey, publish, checkLogin } = useNostr() const { pubkey, publish, checkLogin } = useNostr()
const { addReplies } = useReply()
const { uploadingFiles, setUploadingFiles } = usePostEditor() const { uploadingFiles, setUploadingFiles } = usePostEditor()
const [text, setText] = useState('') const [text, setText] = useState('')
const textareaRef = useRef<TPostTextareaHandle>(null) const textareaRef = useRef<TPostTextareaHandle>(null)
@ -128,10 +130,11 @@ export default function PostContent({
isNsfw isNsfw
}) })
await publish(draftEvent, { const newEvent = await publish(draftEvent, {
specifiedRelayUrls, specifiedRelayUrls,
additionalRelayUrls: isPoll ? pollCreateData.relays : [] additionalRelayUrls: isPoll ? pollCreateData.relays : []
}) })
addReplies([newEvent])
postEditorCache.clearPostCache({ defaultContent, parentEvent }) postEditorCache.clearPostCache({ defaultContent, parentEvent })
close() close()
} catch (error) { } catch (error) {

Loading…
Cancel
Save