Clear autosave on submit post/market/comment

This commit is contained in:
Sinclair Chen 2022-10-07 19:57:07 -07:00
parent 9736e2d4b4
commit 21b6db3c37
4 changed files with 4 additions and 2 deletions

View File

@ -88,7 +88,7 @@ export function CommentInputTextArea(props: {
const submit = () => {
submitComment()
editor?.commands?.clearContent()
editor?.commands?.clearContent(true)
}
useEffect(() => {

View File

@ -46,6 +46,7 @@ export function CreatePost(props: { group?: Group }) {
return e
})
if (result.post) {
editor.commands.clearContent(true)
await Router.push(postPath(result.post.slug))
}
}

View File

@ -81,7 +81,7 @@ export function useTextEditor(props: {
defaultValue?: Content
disabled?: boolean
simple?: boolean
key?: string // unique key for this text field for autosave
key?: string // unique key for autosave. If set, plz call `clearContent(true)` on submit to clear autosave
}) {
const { placeholder, max, defaultValue, disabled, simple, key } = props

View File

@ -269,6 +269,7 @@ export function NewContract(props: {
selectedGroup: selectedGroup?.id,
isFree: false,
})
editor?.commands.clearContent(true)
await router.push(contractPath(result as Contract))
} catch (e) {
console.error('error creating contract', e, (e as any).details)