feat: cache bio draft (#1455)
This commit is contained in:
parent
4ce395889d
commit
c400a6c1c6
@ -21,7 +21,7 @@ export const getServerSideProps = getGetServerSideProps({
|
|||||||
notFound: data => !data.user
|
notFound: data => !data.user
|
||||||
})
|
})
|
||||||
|
|
||||||
export function BioForm ({ handleDone, bio }) {
|
export function BioForm ({ handleDone, bio, me }) {
|
||||||
const [upsertBio] = useMutation(
|
const [upsertBio] = useMutation(
|
||||||
gql`
|
gql`
|
||||||
${ITEM_FIELDS}
|
${ITEM_FIELDS}
|
||||||
@ -60,6 +60,7 @@ export function BioForm ({ handleDone, bio }) {
|
|||||||
if (error) throw error
|
if (error) throw error
|
||||||
handleDone?.()
|
handleDone?.()
|
||||||
}}
|
}}
|
||||||
|
storageKeyPrefix={`bio-${me.id}`}
|
||||||
>
|
>
|
||||||
<MarkdownInput
|
<MarkdownInput
|
||||||
topLevel
|
topLevel
|
||||||
@ -100,14 +101,14 @@ export default function User ({ ssrData }) {
|
|||||||
? (edit
|
? (edit
|
||||||
? (
|
? (
|
||||||
<div className={styles.create}>
|
<div className={styles.create}>
|
||||||
<BioForm bio={user.bio} handleDone={() => setEdit(false)} />
|
<BioForm bio={user.bio} me={me} handleDone={() => setEdit(false)} />
|
||||||
</div>)
|
</div>)
|
||||||
: <ItemFull item={user.bio} bio handleClick={setEdit} />
|
: <ItemFull item={user.bio} bio handleClick={setEdit} />
|
||||||
)
|
)
|
||||||
: (mine &&
|
: (mine &&
|
||||||
<div className={styles.create}>
|
<div className={styles.create}>
|
||||||
{create
|
{create
|
||||||
? <BioForm handleDone={() => setCreate(false)} />
|
? <BioForm me={me} handleDone={() => setCreate(false)} />
|
||||||
: (
|
: (
|
||||||
mine &&
|
mine &&
|
||||||
<div className='text-center'>
|
<div className='text-center'>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user