Browse Source

refactor: avoid loading default sort in shared view

- Hide existing sort options and by default sort it internally
- If user provides sort option override the default one

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/6788/head
Pranav C 1 year ago
parent
commit
cd1b4b549e
  1. 2
      packages/nc-gui/components/shared-view/Gallery.vue
  2. 4
      packages/nc-gui/components/shared-view/Grid.vue
  3. 2
      packages/nc-gui/components/shared-view/Kanban.vue
  4. 2
      packages/nc-gui/components/shared-view/Map.vue
  5. 4
      packages/nc-gui/composables/useViewSorts.ts

2
packages/nc-gui/components/shared-view/Gallery.vue

@ -19,7 +19,7 @@ provide(IsPublicInj, ref(true))
useProvideViewColumns(sharedView, meta, () => reloadEventHook?.trigger(), true)
useProvideSmartsheetStore(sharedView, meta, true, sorts, nestedFilters)
useProvideSmartsheetStore(sharedView, meta, true, ref([]), nestedFilters)
</script>
<template>

4
packages/nc-gui/components/shared-view/Grid.vue

@ -17,13 +17,13 @@ import {
useSharedView,
} from '#imports'
const { sharedView, meta, sorts, nestedFilters } = useSharedView()
const { sharedView, meta, nestedFilters } = useSharedView()
const { signedIn } = useGlobal()
const { loadProject } = useBase()
const { isLocked } = useProvideSmartsheetStore(sharedView, meta, true, sorts, nestedFilters)
const { isLocked } = useProvideSmartsheetStore(sharedView, meta, true, ref([]), nestedFilters)
useProvideKanbanViewStore(meta, sharedView)

2
packages/nc-gui/components/shared-view/Kanban.vue

@ -27,7 +27,7 @@ provide(IsPublicInj, ref(true))
useProvideViewColumns(sharedView, meta, () => reloadEventHook?.trigger(), true)
useProvideSmartsheetStore(sharedView, meta, true, sorts, nestedFilters)
useProvideSmartsheetStore(sharedView, meta, true, ref([]), nestedFilters)
useProvideKanbanViewStore(meta, sharedView, true)
</script>

2
packages/nc-gui/components/shared-view/Map.vue

@ -27,7 +27,7 @@ provide(IsPublicInj, ref(true))
useProvideViewColumns(sharedView, meta, () => reloadEventHook?.trigger(), true)
useProvideSmartsheetStore(sharedView, meta, true, sorts, nestedFilters)
useProvideSmartsheetStore(sharedView, meta, true, ref([]), nestedFilters)
useProvideMapViewStore(meta, sharedView, true)
</script>

4
packages/nc-gui/composables/useViewSorts.ts

@ -42,9 +42,7 @@ export function useViewSorts(view: Ref<ViewType | undefined>, reloadData?: () =>
const loadSorts = async () => {
if (isPublic.value) {
// todo: sorts missing on `ViewType`
const sharedSorts = (sharedView.value as any)?.sorts || []
sorts.value = [...sharedSorts]
sorts.value = []
return
}

Loading…
Cancel
Save