feat: cache bio draft (#1455)

This commit is contained in:
toyota-corolla0 2024-10-02 18:06:22 -05:00 committed by GitHub
parent 4ce395889d
commit c400a6c1c6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 3 deletions

View File

@ -21,7 +21,7 @@ export const getServerSideProps = getGetServerSideProps({
notFound: data => !data.user
})
export function BioForm ({ handleDone, bio }) {
export function BioForm ({ handleDone, bio, me }) {
const [upsertBio] = useMutation(
gql`
${ITEM_FIELDS}
@ -60,6 +60,7 @@ export function BioForm ({ handleDone, bio }) {
if (error) throw error
handleDone?.()
}}
storageKeyPrefix={`bio-${me.id}`}
>
<MarkdownInput
topLevel
@ -100,14 +101,14 @@ export default function User ({ ssrData }) {
? (edit
? (
<div className={styles.create}>
<BioForm bio={user.bio} handleDone={() => setEdit(false)} />
<BioForm bio={user.bio} me={me} handleDone={() => setEdit(false)} />
</div>)
: <ItemFull item={user.bio} bio handleClick={setEdit} />
)
: (mine &&
<div className={styles.create}>
{create
? <BioForm handleDone={() => setCreate(false)} />
? <BioForm me={me} handleDone={() => setCreate(false)} />
: (
mine &&
<div className='text-center'>