From 9b20269d08857eec30281c111ca4cae8f3affc7d Mon Sep 17 00:00:00 2001 From: mertmit Date: Wed, 6 Sep 2023 16:41:50 +0300 Subject: [PATCH] fix: warnings in ui Signed-off-by: mertmit --- .../nc-gui/components/dashboard/settings/DataSources.vue | 5 ++--- .../dashboard/settings/data-sources/CreateBase.vue | 4 ++-- packages/nc-gui/components/dlg/ViewCreate.vue | 8 +++++++- packages/nc-gui/components/nc/Button.vue | 8 +++++++- packages/nc-gui/components/nc/Tabs.vue | 7 ------- packages/nc-gui/components/project/AccessSettings.vue | 2 +- packages/nc-gui/components/project/AllTables.vue | 5 ++++- .../components/project/InviteProjectCollabSection.vue | 8 ++++++++ .../nc-gui/components/smartsheet/toolbar/GroupByMenu.vue | 1 - .../nc-gui/components/workspace/CollaboratorsList.vue | 2 +- 10 files changed, 32 insertions(+), 18 deletions(-) diff --git a/packages/nc-gui/components/dashboard/settings/DataSources.vue b/packages/nc-gui/components/dashboard/settings/DataSources.vue index 3319fc36a6..fba38d7856 100644 --- a/packages/nc-gui/components/dashboard/settings/DataSources.vue +++ b/packages/nc-gui/components/dashboard/settings/DataSources.vue @@ -52,6 +52,7 @@ async function loadBases(changed?: boolean) { try { if (changed) refreshCommandPalette() + await until(() => !!project.value.id).toBeTruthy() isReloading.value = true vReload.value = true const baseList = await $api.base.list(project.value.id as string) @@ -164,8 +165,7 @@ const forceAwaken = () => { onMounted(async () => { if (sources.value.length === 0) { - await loadBases() - await loadMetaDiff() + loadBases() } }) @@ -174,7 +174,6 @@ watch( async (reload) => { if (reload && !isReloading.value) { await loadBases() - await loadMetaDiff() } }, ) diff --git a/packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue b/packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue index 6bb55c0941..9c6e5e5ae2 100644 --- a/packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue +++ b/packages/nc-gui/components/dashboard/settings/data-sources/CreateBase.vue @@ -350,8 +350,8 @@ onMounted(async () => { // todo: replace setTimeout and follow better approach setTimeout(() => { const input = form.value?.$el?.querySelector('input[type=text]') - input.setSelectionRange(0, formState.value.title.length) - input.focus() + input?.setSelectionRange(0, formState.value.title.length) + input?.focus() }, 500) }) }) diff --git a/packages/nc-gui/components/dlg/ViewCreate.vue b/packages/nc-gui/components/dlg/ViewCreate.vue index 86557e85c5..185d5bb2e2 100644 --- a/packages/nc-gui/components/dlg/ViewCreate.vue +++ b/packages/nc-gui/components/dlg/ViewCreate.vue @@ -156,7 +156,13 @@ function init() { } async function onSubmit() { - const isValid = await formValidator.value?.validateFields() + let isValid = null + + try { + isValid = await formValidator.value?.validateFields() + } catch (e) { + console.error(e) + } if (isValid && form.type) { const _meta = unref(meta) diff --git a/packages/nc-gui/components/nc/Button.vue b/packages/nc-gui/components/nc/Button.vue index b6d594faa1..70cf2ebaee 100644 --- a/packages/nc-gui/components/nc/Button.vue +++ b/packages/nc-gui/components/nc/Button.vue @@ -33,6 +33,8 @@ const emits = defineEmits(['update:loading']) const slots = useSlots() +const NcButton = ref(null) + const size = computed(() => props.size) const type = computed(() => props.type) @@ -63,10 +65,15 @@ const onBlur = () => { isFocused.value = false isClicked.value = false } + +useEventListener(NcButton, 'mousedown', () => { + isClicked.value = true +})