Userbox: clean up selected for user box on value change (#2199)

Signed-off-by: Anna <anna.no@xored.com>
This commit is contained in:
Anna No 2022-07-04 14:18:38 +07:00 committed by GitHub
parent da844e4616
commit f30961e665
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -62,11 +62,11 @@
const client = getClient()
async function updateSelected (value: Ref<Contact>) {
selected = await client.findOne(_class, { _id: value })
async function updateSelected (value: Ref<Contact> | null | undefined) {
selected = value ? await client.findOne(_class, { _id: value }) : undefined
}
$: if (value != null) updateSelected(value)
$: updateSelected(value)
function getName (obj: Contact): string {
const isPerson = client.getHierarchy().isDerived(obj._class, contact.class.Person)