Browse Source

fix: ResizeObserver bug and missing error handler

pull/9112/head
Pranav C 5 months ago
parent
commit
3ca9222b78
  1. 21
      packages/nc-gui/app.vue
  2. 34
      packages/nc-gui/composables/useViewColumns.ts

21
packages/nc-gui/app.vue

@ -96,6 +96,27 @@ onMounted(() => {
refreshCommandPalette()
})
})
// ref: https://github.com/vuejs/vue-cli/issues/7431#issuecomment-1793385162
// Stop error resizeObserver
const debounce = (callback: (...args: any[]) => void, delay: number) => {
let tid: any
return function (...args: any[]) {
const ctx = self
tid && clearTimeout(tid)
tid = setTimeout(() => {
callback.apply(ctx, args)
}, delay)
}
}
const _ = (window as any).ResizeObserver
;(window as any).ResizeObserver = class ResizeObserver extends _ {
constructor(callback: (...args: any[]) => void) {
callback = debounce(callback, 20)
super(callback)
}
}
</script>
<template>

34
packages/nc-gui/composables/useViewColumns.ts

@ -434,23 +434,27 @@ const [useProvideViewColumns, useViewColumns] = useInjectionState(
scope: defineViewScope({ view: view.value }),
})
}
try {
// sync with server if allowed
if (!isPublic.value && isUIAllowed('viewFieldEdit') && gridViewCols.value[id]?.id) {
await $api.dbView.gridColumnUpdate(gridViewCols.value[id].id as string, {
...props,
})
}
// sync with server if allowed
if (!isPublic.value && isUIAllowed('viewFieldEdit') && gridViewCols.value[id]?.id) {
await $api.dbView.gridColumnUpdate(gridViewCols.value[id].id as string, {
...props,
})
}
if (gridViewCols.value?.[id]) {
Object.assign(gridViewCols.value[id], {
...gridViewCols.value[id],
...props,
})
} else {
// fallback to reload
await loadViewColumns()
}
}catch (e) {
}
if (gridViewCols.value?.[id]) {
Object.assign(gridViewCols.value[id], {
...gridViewCols.value[id],
...props,
})
} else {
// fallback to reload
await loadViewColumns()
}
}
watch(

Loading…
Cancel
Save