Skip to content

Commit 65b8461

Browse files
authored
Merge pull request #170 from CivicDataLab/162-fix-drafts-published-datasets-listing
fix-drafts-published-datasets-listing
2 parents 02d698f + c404010 commit 65b8461

File tree

1 file changed

+15
-15
lines changed
  • app/[locale]/dashboard/organization/[organizationId]/dataset

1 file changed

+15
-15
lines changed

app/[locale]/dashboard/organization/[organizationId]/dataset/page.tsx

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import { Content } from './components/content';
1616
import { Navigation } from './components/navigate-org-datasets';
1717

1818
const allDatasetsQueryDoc: any = graphql(`
19-
query allDatasetsQuery($filters: DatasetFilter) {
20-
datasets(filters: $filters) {
19+
query allDatasetsQuery($filters: DatasetFilter, $order: DatasetOrder) {
20+
datasets(filters: $filters, order: $order) {
2121
title
2222
id
2323
created
@@ -65,16 +65,6 @@ export default function DatasetPage({
6565
url: `drafts`,
6666
selected: navigationTab === 'drafts',
6767
},
68-
{
69-
label: 'Under Moderation',
70-
url: `under-moderation`,
71-
selected: navigationTab === 'under-moderation',
72-
},
73-
{
74-
label: 'Needs Review',
75-
url: `needs-review`,
76-
selected: navigationTab === 'needs-review',
77-
},
7868
{
7969
label: 'Published',
8070
url: `published`,
@@ -83,8 +73,19 @@ export default function DatasetPage({
8373
];
8474

8575
const AllDatasetsQuery: { data: any; isLoading: boolean; refetch: any } =
86-
useQuery([`fetch_datasets_org_dashboard`], () =>
87-
GraphQL(allDatasetsQueryDoc, [])
76+
useQuery(
77+
[`fetch_datasets_org_dashboard`],
78+
() =>
79+
GraphQL(allDatasetsQueryDoc, {
80+
filters: {
81+
status: navigationTab === 'published' ? 'PUBLISHED' : 'DRAFT',
82+
},
83+
order: { modified: 'DESC' }
84+
}),
85+
{
86+
refetchOnMount: true,
87+
refetchOnReconnect: true,
88+
}
8889
);
8990

9091
useEffect(() => {
@@ -93,7 +94,6 @@ export default function DatasetPage({
9394
AllDatasetsQuery.refetch();
9495
}, [navigationTab]);
9596

96-
9797
const DeleteDatasetMutation: {
9898
mutate: any;
9999
isLoading: boolean;

0 commit comments

Comments
 (0)