diff --git a/packages/nc-gui-v2/composables/useViewSorts.ts b/packages/nc-gui-v2/composables/useViewSorts.ts index b6a3fa6bc0..e343fd14f2 100644 --- a/packages/nc-gui-v2/composables/useViewSorts.ts +++ b/packages/nc-gui-v2/composables/useViewSorts.ts @@ -7,11 +7,15 @@ export function useViewSorts( reloadData?: () => void, ) { const _sorts = ref([]) + const { sorts: sharedViewSorts, sharedView } = useSharedView() const reloadHook = inject(ReloadViewDataHookInj) + const isPublic = inject(IsPublicInj, ref(false)) + const { isSharedBase } = useProject() + const sorts = computed({ get: () => (isPublic.value ? sharedViewSorts.value : _sorts.value), set: (value) => { @@ -39,9 +43,8 @@ export function useViewSorts( } const saveOrUpdate = async (sort: SortType, i: number) => { - // TODO: - // if (!this.shared && this._isUIAllowed('sortSync')) { - if (isPublic.value) { + if (isPublic.value || isSharedBase) { + // FIXME: not working for isSharedBase case sorts.value[i] = sort sorts.value = [...sorts.value] return @@ -66,10 +69,7 @@ export function useViewSorts( } const deleteSort = async (sort: SortType, i: number) => { - // TOOD: - // if (!this.shared && sort.id && this._isUIAllowed('sortSync')) { - - if (isUIAllowed('sortSync') && sort.id && !isPublic.value) { + if (isUIAllowed('sortSync') && sort.id && !isPublic.value && !isSharedBase) { await $api.dbTableSort.delete(sort.id) } sorts.value.splice(i, 1)