Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Suspense } from "react";
import ExploreBtn from "@/components/ExploreBtn";
import EventCard from "@/components/EventCard";
import SearchFilters from "@/components/SearchFilters"; // Added missing import
import Footer from "@/components/Footer"; // Added missing import
import SearchFilters from "@/components/SearchFilters";
import Footer from "@/components/Footer";
import { IEvent } from "@/database";
import { getAllEvents } from "@/lib/actions/event.actions";

Expand All @@ -14,12 +15,9 @@ interface PageProps {
}

const Page = async ({ searchParams }: PageProps) => {

// 1. Resolve search variables from the URL router interface
const resolvedParams = await searchParams;

// 2. Fixed Destructuring: Receives plain array directly from your updated action
const events = await getAllEvents({
const { events } = await getAllEvents({
query: resolvedParams.query,
mode: resolvedParams.mode,
tag: resolvedParams.tag,
Expand All @@ -32,15 +30,15 @@ const Page = async ({ searchParams }: PageProps) => {

<ExploreBtn />

{/* 3. Insert the newly generated Search and Filter component bar */}
<div className="mt-10">
<SearchFilters />
<Suspense fallback={<div className="w-full h-16 animate-pulse rounded-xl bg-white/5" />}>
<SearchFilters />
</Suspense>
</div>

<div className="mt-20 space-y-7">
<h3>Featured Events</h3>

{/* 4. Display list layout conditionally or deliver clean placeholder states */}
{events && events.length > 0 ? (
<ul className="events">
{events.map((event: IEvent) => (
Expand Down
1 change: 1 addition & 0 deletions lib/mongodb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ async function connectToDatabase(): Promise<Mongoose> {
if (!cached.promise) {
const options = {
bufferCommands: false, // Disable command buffering for better error handling
serverSelectionTimeoutMS: 5000,
Comment thread
SatyamPandey-07 marked this conversation as resolved.
};

cached.promise = mongoose.connect(MONGODB_URI, options);
Expand Down
Loading