Sorting fix (#725)

Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
Denis Bykhov 2021-12-23 19:59:09 +06:00 committed by GitHub
parent 4673bbfa6d
commit 11266c080e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,7 @@ export async function getObjectPresenter (client: Client, _class: Ref<Class<Obj>
}
}
const presenter = await getResource(presenterMixin.presenter)
const key = typeof preserveKey === 'string' ? preserveKey : ''
const key = preserveKey.sortingKey ?? preserveKey.key
const sortingKey = clazz.sortingKey ?
(key.length > 0 ? key + '.' + clazz.sortingKey : clazz.sortingKey)
: key
@ -64,7 +64,7 @@ async function getAttributePresenter (client: Client, _class: Ref<Class<Obj>>, k
if (presenterMixin.presenter === undefined) {
throw new Error('attribute presenter not found for ' + JSON.stringify(preserveKey))
}
const resultKey = typeof preserveKey === 'string' ? preserveKey : ''
const resultKey = preserveKey.sortingKey ?? preserveKey.key
const sortingKey = attribute.type._class === core.class.ArrOf ? resultKey + '.length' : resultKey
const presenter = await getResource(presenterMixin.presenter)
return {