Browse Source

Merge pull request #6788 from nocodb/fix/6456-shred-view-sort

refactor: Avoid loading default sort in shared view
pull/6805/head
Raju Udava 1 year ago committed by GitHub
parent
commit
11bac80e59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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
  6. 1
      tests/playwright/tests/db/views/viewGridShare.spec.ts

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

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

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

@ -17,13 +17,13 @@ import {
useSharedView, useSharedView,
} from '#imports' } from '#imports'
const { sharedView, meta, sorts, nestedFilters } = useSharedView() const { sharedView, meta, nestedFilters } = useSharedView()
const { signedIn } = useGlobal() const { signedIn } = useGlobal()
const { loadProject } = useBase() const { loadProject } = useBase()
const { isLocked } = useProvideSmartsheetStore(sharedView, meta, true, sorts, nestedFilters) const { isLocked } = useProvideSmartsheetStore(sharedView, meta, true, ref([]), nestedFilters)
useProvideKanbanViewStore(meta, sharedView) 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) useProvideViewColumns(sharedView, meta, () => reloadEventHook?.trigger(), true)
useProvideSmartsheetStore(sharedView, meta, true, sorts, nestedFilters) useProvideSmartsheetStore(sharedView, meta, true, ref([]), nestedFilters)
useProvideKanbanViewStore(meta, sharedView, true) useProvideKanbanViewStore(meta, sharedView, true)
</script> </script>

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

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

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

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

1
tests/playwright/tests/db/views/viewGridShare.spec.ts

@ -210,7 +210,6 @@ test.describe('Shared view', () => {
**/ **/
// create new sort & filter criteria in shared view // create new sort & filter criteria in shared view
await sharedPage.grid.toolbar.sort.reset();
await sharedPage.grid.toolbar.sort.add({ await sharedPage.grid.toolbar.sort.add({
title: 'Address', title: 'Address',
ascending: true, ascending: true,

Loading…
Cancel
Save