Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix: reload filters/sorts when base roles change after direct URL navigation

Pranav C5fda821b82f1
diff --git a/packages/nc-gui/components/smartsheet/toolbar/ColumnFilterMenu.vue b/packages/nc-gui/components/smartsheet/toolbar/ColumnFilterMenu.vue
index 06630af459..f5d79e1ebb 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/ColumnFilterMenu.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/ColumnFilterMenu.vue
@@ -44,9 +44,11 @@ const filtersLength = ref(0)
// If view is locked OR user lacks permission to sync filters (Editor), show restricted UI
const isRestrictedEditor = computed(() => !isUIAllowed('filterSync'))
+const { baseRoles } = useRoles()
+
watch(
- () => activeView?.value?.id,
- async (viewId) => {
+ [() => activeView?.value?.id, baseRoles],
+ async ([viewId]) => {
if (viewId) {
await loadFilters({
hookId: undefined,
@@ -56,7 +58,7 @@ watch(
filtersLength.value = nonDeletedFilters.value.length || 0
}
},
- { immediate: true },
+ { immediate: true, deep: true },
)
const existingFilters = computed(() => {
diff --git a/packages/nc-gui/components/smartsheet/toolbar/SortListMenu.vue b/packages/nc-gui/components/smartsheet/toolbar/SortListMenu.vue
index e57c62a62c..2ea0a2aaa9 100644
--- a/packages/nc-gui/components/smartsheet/toolbar/SortListMenu.vue
+++ b/packages/nc-gui/components/smartsheet/toolbar/SortListMenu.vue
@@ -12,7 +12,7 @@ const isPublic = inject(IsPublicInj, ref(false))
const clone = rfdc()
const { eventBus } = useSmartsheetStoreOrThrow()
-const { isUIAllowed } = useRoles()
+const { isUIAllowed, baseRoles } = useRoles()
const { sorts, saveOrUpdate, loadSorts, addSort: _addSort, deleteSort } = useViewSorts(view, () => reloadDataHook?.trigger())
@@ -124,9 +124,15 @@ watch(open, () => {
const getSortIndex = (sort: any) => sorts.value.findIndex((s) => s === sort)
-onMounted(() => {
- loadSorts()
-})
+watch(
+ [() => view?.value?.id, baseRoles],
+ ([viewId]) => {
+ if (viewId) {
+ loadSorts()
+ }
+ },
+ { immediate: true, deep: true },
+)
</script>
<template>