diff --git a/apps/app/src/app/[locale]/(main)/decisions/page.tsx b/apps/app/src/app/[locale]/(main)/decisions/page.tsx
index 4ac66d433..8f8d5325c 100644
--- a/apps/app/src/app/[locale]/(main)/decisions/page.tsx
+++ b/apps/app/src/app/[locale]/(main)/decisions/page.tsx
@@ -1,31 +1,10 @@
-import { DecisionProfileList, ProcessStatus } from '@op/api/encoders';
-import { createClient } from '@op/api/serverClient';
-
import { AllDecisions } from '@/components/decisions/AllDecisions';
import {
ListPageLayout,
ListPageLayoutHeader,
} from '@/components/layout/ListPageLayout';
-export const dynamic = 'force-dynamic';
-
-const DecisionsListingPage = async () => {
- let decisions: DecisionProfileList = {
- items: [],
- next: null,
- };
-
- try {
- const client = await createClient();
- decisions = await client.decision.listDecisionProfiles({
- limit: 20,
- status: ProcessStatus.PUBLISHED,
- });
- } catch (error) {
- // log error but return the empty list
- console.log(error);
- }
-
+const DecisionsListingPage = () => {
return (
@@ -34,7 +13,7 @@ const DecisionsListingPage = async () => {
Discover new ways to collectively decide together.
-
+
);
};
diff --git a/apps/app/src/components/decisions/AllDecisions/index.tsx b/apps/app/src/components/decisions/AllDecisions/index.tsx
index d39e12f3b..f65a57ddc 100644
--- a/apps/app/src/components/decisions/AllDecisions/index.tsx
+++ b/apps/app/src/components/decisions/AllDecisions/index.tsx
@@ -2,9 +2,9 @@
import { useUser } from '@/utils/UserProvider';
import { trpc } from '@op/api/client';
-import { DecisionProfileList, ProcessStatus } from '@op/api/encoders';
+import { ProcessStatus } from '@op/api/encoders';
import { useInfiniteScroll } from '@op/hooks';
-import { SkeletonLine } from '@op/ui/Skeleton';
+import { Skeleton } from '@op/ui/Skeleton';
import { Tab, TabList, TabPanel, Tabs } from '@op/ui/Tabs';
import { Suspense } from 'react';
@@ -14,13 +14,44 @@ import ErrorBoundary from '@/components/ErrorBoundary';
import { DecisionListItem } from '../DecisionListItem';
+const DecisionListItemSkeleton = () => (
+
+);
+
+const DecisionsListSkeleton = () => (
+
+ {Array.from({ length: 3 }).map((_, i) => (
+
+ ))}
+
+);
+
const DecisionsListSuspense = ({
status,
- initialData,
ownerProfileId,
}: {
status: ProcessStatus;
- initialData?: DecisionProfileList;
ownerProfileId?: string;
}) => {
const {
@@ -34,17 +65,9 @@ const DecisionsListSuspense = ({
status,
ownerProfileId,
},
- initialData
- ? {
- initialData: {
- pages: [initialData],
- pageParams: [null],
- },
- getNextPageParam: (lastPage) => lastPage.next,
- }
- : {
- getNextPageParam: (lastPage) => lastPage.next,
- },
+ {
+ getNextPageParam: (lastPage) => lastPage.next,
+ },
);
const { ref, shouldShowTrigger } = useInfiniteScroll(fetchNextPage, {
@@ -75,18 +98,14 @@ const DecisionsListSuspense = ({
ref={ref as React.RefObject}
className="flex justify-center py-4"
>
- {isFetchingNextPage ? : null}
+ {isFetchingNextPage ? : null}
)}
);
};
-const AllDecisionsTabs = ({
- initialData,
-}: {
- initialData?: DecisionProfileList;
-}) => {
+const AllDecisionsTabs = () => {
const t = useTranslations();
const { user } = useUser();
const ownerProfileId = user.currentProfile?.id;
@@ -115,16 +134,16 @@ const AllDecisionsTabs = ({
- }>
+ }>
{hasDrafts && (
- }>
+ }>
)}
- }>
+ }>
@@ -141,20 +160,13 @@ const AllDecisionsTabs = ({
);
};
-export const AllDecisions = ({
- initialData,
-}: {
- initialData?: DecisionProfileList;
-}) => {
+export const AllDecisions = () => {
const { user } = useUser();
return (
Could not load decisions}>
- }>
-
+ }>
+
);