import { Form, MarkdownInput, SubmitButton } from '../components/form' import * as Yup from 'yup' import { gql, useMutation } from '@apollo/client' import styles from './reply.module.css' import TextareaAutosize from 'react-textarea-autosize' import Countdown from '../components/countdown' export const CommentSchema = Yup.object({ text: Yup.string().required('required').trim() }) export default function CommentEdit ({ comment, editThreshold, onSuccess, onCancel }) { const [updateComment] = useMutation( gql` mutation updateComment($id: ID! $text: String!) { updateComment(id: $id, text: $text) { text } }`, { update (cache, { data: { updateComment } }) { cache.modify({ id: `Item:${comment.id}`, fields: { text () { return updateComment.text } } }) } } ) return (