diff --git a/packages/nc-gui/components/smartsheet/grid/GroupBy.vue b/packages/nc-gui/components/smartsheet/grid/GroupBy.vue index d314f47274..96e5d214f9 100644 --- a/packages/nc-gui/components/smartsheet/grid/GroupBy.vue +++ b/packages/nc-gui/components/smartsheet/grid/GroupBy.vue @@ -133,10 +133,16 @@ const activeGroups = computed(() => { const oldActiveGroups = ref([]) -const findAndLoadSubGroup = (key: any) => { +const findAndLoadSubGroup = async (key: any) => { key = Array.isArray(key) ? key : [key] if (key.length > 0 && vGroup.value.children) { if (!oldActiveGroups.value.includes(key[key.length - 1])) { + // wait until children loads since it may be still loading in background + // todo: implement a better way to handle this + await until(() => vGroup.value.children?.length > 0).toBeTruthy({ + timeout: 10000, + }) + const k = key[key.length - 1].replace('group-panel-', '') const grp = vGroup.value.children.find((g) => `${g.key}` === k) if (grp) { @@ -278,13 +284,13 @@ const shouldRenderCell = (column) => UITypes.LastModifiedBy, ].includes(column?.uidt) -const expandGroup = (key: string) => { +const expandGroup = async (key: string) => { if (Array.isArray(_activeGroupKeys.value)) { _activeGroupKeys.value.push(`group-panel-${key}`) } else { _activeGroupKeys.value = [`group-panel-${key}`] } - findAndLoadSubGroup(`group-panel-${key}`) + await findAndLoadSubGroup(`group-panel-${key}`) } const collapseGroup = (key: string) => { @@ -299,13 +305,15 @@ const collapseAllGroup = () => { _activeGroupKeys.value = [] } -const expandAllGroup = () => { +const expandAllGroup = async () => { _activeGroupKeys.value = vGroup.value.children?.map((g) => `group-panel-${g.key}`) ?? [] if (vGroup.value.children) { - vGroup.value.children.forEach((g) => { - findAndLoadSubGroup(`group-panel-${g.key}`) - }) + await Promise.all( + vGroup.value.children.map((g) => { + return findAndLoadSubGroup(`group-panel-${g.key}`) + }), + ) } } diff --git a/packages/nc-gui/components/workspace/CollaboratorsList.vue b/packages/nc-gui/components/workspace/CollaboratorsList.vue index 5d80ce6db4..dbe1ee2001 100644 --- a/packages/nc-gui/components/workspace/CollaboratorsList.vue +++ b/packages/nc-gui/components/workspace/CollaboratorsList.vue @@ -1,4 +1,5 @@