Skip to content

Commit d25bac9

Browse files
authored
Merge pull request #18 from camel-ai/community-server
bugfix page
2 parents c1761e9 + 4702db0 commit d25bac9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

app/page.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import Image from "next/image";
44
import { useState, useEffect, Suspense } from "react";
5-
import { useRouter, useSearchParams } from "next/navigation";
5+
import { useSearchParams } from "next/navigation";
66
import { anthropicServers, officialServers, camelServers, communityServers } from "@/public/servers";
77
import {
88
Card,
@@ -169,7 +169,6 @@ function Modal({ server, onClose }: ModalProps) {
169169
}
170170

171171
function HomeContent() {
172-
const router = useRouter();
173172
const searchParams = useSearchParams();
174173
const [selectedServer, setSelectedServer] = useState<Server | null>(null);
175174
const [isModalOpen, setIsModalOpen] = useState(false);
@@ -188,16 +187,18 @@ function HomeContent() {
188187
const handleFilterChange = (newFilter: 'all' | 'official' | 'anthropic' | 'camel' | 'community') => {
189188
setFilter(newFilter);
190189

191-
// Update URL search params without navigation
192-
const params = new URLSearchParams(searchParams);
190+
// Use browser History API directly
191+
const params = new URLSearchParams(window.location.search);
193192
if (newFilter === 'all') {
194193
params.delete('filter');
195194
} else {
196195
params.set('filter', newFilter);
197196
}
198197

199198
const newUrl = params.toString() ? `/?${params.toString()}` : '/';
200-
router.replace(newUrl, { scroll: false });
199+
200+
// Use History API instead of Next.js router
201+
window.history.replaceState({}, '', newUrl);
201202
};
202203

203204
const handleCardClick = (server: Server) => {

0 commit comments

Comments
 (0)