Edit doc update fix (#2632)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-02-14 10:48:36 +06:00 committed by GitHub
parent 47d5db2f61
commit 168ad1031f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -116,7 +116,7 @@
let inplaceAttributes: string[] = [] let inplaceAttributes: string[] = []
let ignoreMixins: Set<Ref<Mixin<Doc>>> = new Set<Ref<Mixin<Doc>>>() let ignoreMixins: Set<Ref<Mixin<Doc>>> = new Set<Ref<Mixin<Doc>>>()
async function updateKeys (showAllMixins: boolean): Promise<void> { async function updateKeys (): Promise<void> {
const keysMap = new Map(getFiltredKeys(hierarchy, realObjectClass, ignoreKeys).map((p) => [p.attr._id, p])) const keysMap = new Map(getFiltredKeys(hierarchy, realObjectClass, ignoreKeys).map((p) => [p.attr._id, p]))
for (const m of mixins) { for (const m of mixins) {
const mkeys = getFiltredKeys(hierarchy, m._id, ignoreKeys) const mkeys = getFiltredKeys(hierarchy, m._id, ignoreKeys)
@ -170,12 +170,12 @@
$: editorFooter = getEditorFooter(_class) $: editorFooter = getEditorFooter(_class)
$: getEditorOrDefault(realObjectClass, showAllMixins, _id) $: getEditorOrDefault(realObjectClass, _id)
function getEditorOrDefault (_class: Ref<Class<Doc>>, showAllMixins: boolean, _id: Ref<Doc>): void { async function getEditorOrDefault (_class: Ref<Class<Doc>>, _id: Ref<Doc>): Promise<void> {
parentClass = hierarchy.getParentClass(_class) parentClass = hierarchy.getParentClass(_class)
await updateKeys()
mainEditor = getEditor(_class) mainEditor = getEditor(_class)
updateKeys(showAllMixins)
} }
async function getFieldEditor (key: KeyedAttribute): Promise<AnyComponent | undefined> { async function getFieldEditor (key: KeyedAttribute): Promise<AnyComponent | undefined> {
@ -267,7 +267,7 @@
allowedCollections = ev.detail.allowedCollections ?? [] allowedCollections = ev.detail.allowedCollections ?? []
collectionArrays = ev.detail.collectionArrays ?? [] collectionArrays = ev.detail.collectionArrays ?? []
getMixins(parentClass, object, showAllMixins) getMixins(parentClass, object, showAllMixins)
updateKeys(showAllMixins) updateKeys()
} }
</script> </script>
@ -323,7 +323,7 @@
<Component <Component
is={headerEditor} is={headerEditor}
props={{ object, keys, mixins, ignoreKeys, vertical: dir === 'column', allowedCollections }} props={{ object, keys, mixins, ignoreKeys, vertical: dir === 'column', allowedCollections }}
on:update={() => updateKeys(showAllMixins)} on:update={updateKeys}
/> />
{:else if dir === 'column'} {:else if dir === 'column'}
<DocAttributeBar <DocAttributeBar
@ -331,7 +331,7 @@
{mixins} {mixins}
ignoreKeys={[...ignoreKeys, ...collectionArrays, ...inplaceAttributes]} ignoreKeys={[...ignoreKeys, ...collectionArrays, ...inplaceAttributes]}
{allowedCollections} {allowedCollections}
on:update={() => updateKeys(showAllMixins)} on:update={updateKeys}
/> />
{:else} {:else}
<AttributesBar {object} _class={realObjectClass} {keys} /> <AttributesBar {object} _class={realObjectClass} {keys} />