diff --git a/package.json b/package.json
index c637c9be..0bd21aa2 100644
--- a/package.json
+++ b/package.json
@@ -56,6 +56,7 @@
"react": "^18.2.0",
"react-activity-calendar": "^2.7.1",
"react-dom": "^18.2.0",
+ "react-intersection-observer": "^9.15.1",
"react-markdown": "^9.0.1",
"react-player": "^2.16.0",
"recharts": "^2.13.3",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 47cd7c51..a5b5da2c 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -140,6 +140,9 @@ importers:
react-dom:
specifier: ^18.2.0
version: 18.2.0(react@18.2.0)
+ react-intersection-observer:
+ specifier: ^9.15.1
+ version: 9.15.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0)
react-markdown:
specifier: ^9.0.1
version: 9.0.1(@types/react@18.2.60)(react@18.2.0)
@@ -5534,6 +5537,15 @@ packages:
react-fast-compare@3.2.2:
resolution: {integrity: sha512-nsO+KSNgo1SbJqJEYRE9ERzo7YtYbou/OqjSQKxV7jcKox7+usiUVZOAC+XnDOABXggQTno0Y1CpVnuWEc1boQ==}
+ react-intersection-observer@9.15.1:
+ resolution: {integrity: sha512-vGrqYEVWXfH+AGu241uzfUpNK4HAdhCkSAyFdkMb9VWWXs6mxzBLpWCxEy9YcnDNY2g9eO6z7qUtTBdA9hc8pA==}
+ peerDependencies:
+ react: ^17.0.0 || ^18.0.0 || ^19.0.0
+ react-dom: ^17.0.0 || ^18.0.0 || ^19.0.0
+ peerDependenciesMeta:
+ react-dom:
+ optional: true
+
react-is@16.13.1:
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
@@ -14404,6 +14416,12 @@ snapshots:
react-fast-compare@3.2.2: {}
+ react-intersection-observer@9.15.1(react-dom@18.2.0(react@18.2.0))(react@18.2.0):
+ dependencies:
+ react: 18.2.0
+ optionalDependencies:
+ react-dom: 18.2.0(react@18.2.0)
+
react-is@16.13.1: {}
react-is@18.2.0: {}
diff --git a/src/components/layout/AgentsContent.tsx b/src/components/layout/AgentsContent.tsx
index 4ae89984..e7c36517 100644
--- a/src/components/layout/AgentsContent.tsx
+++ b/src/components/layout/AgentsContent.tsx
@@ -1,6 +1,10 @@
'use client';
import { useAllAssistants } from '@/hooks/useAssistants';
+import { Skeleton } from '../ui/skeleton';
+import { useState, useEffect } from 'react';
+import { useInView } from 'react-intersection-observer';
+import { useSearchParams } from 'next/navigation';
import dynamic from 'next/dynamic';
import PageLoaderSkeleton from './PageLoaderSkeleton';
@@ -10,11 +14,29 @@ const AllAgentsWithNoSSR = dynamic(
);
const AgentContent = () => {
- const { allAgents: data, loading } = useAllAssistants();
+ const [offset, setOffset] = useState(0);
+ const [hasMore, setHasMore] = useState(true);
+ const searchParams = useSearchParams();
+ const isPlayground = searchParams.get('isPlayground') === 'true';
+ const { allAgents: data, loading } = useAllAssistants(offset, 30);
+ const { ref, inView } = useInView();
- if (loading) {
- return