feat(editor): show fetching state of name auto complete

This commit is contained in:
Anthony Fu 2022-11-27 14:34:38 +08:00
parent 8dd91002d7
commit b475377f64
3 changed files with 16 additions and 5 deletions

View file

@ -48,6 +48,8 @@ export function getDisplayName(account?: Account, options?: { rich?: boolean })
}
export function getShortHandle({ acct }: Account) {
if (!acct)
return ''
return `@${acct.includes('@') ? acct.split('@')[0] : acct}`
}

View file

@ -58,8 +58,12 @@ function createSuggestionRenderer(): SuggestionOptions['render'] {
})
},
onBeforeUpdate(props) {
component.updateProps({ ...props, isPending: true })
},
onUpdate(props) {
component.updateProps(props)
component.updateProps({ ...props, isPending: false })
if (!props.clientRect)
return