Skip to content

home page events also render in proper way#131

Merged
SatyamPandey-07 merged 2 commits into
niharika-mente:mainfrom
Ashitosh0302:feature/home_page_events_render
Jul 2, 2026
Merged

home page events also render in proper way#131
SatyamPandey-07 merged 2 commits into
niharika-mente:mainfrom
Ashitosh0302:feature/home_page_events_render

Conversation

@Ashitosh0302

@Ashitosh0302 Ashitosh0302 commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

Fixes #114 #125

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (non-code modifications)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce.

  • Manual testing (describe steps and browser tested in)
  • Automated tests added/run (if applicable)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings or console errors
  • Any dependent changes have been merged and published in downstream modules

#add the events in the home page also

Summary by CodeRabbit

  • New Features

    • Added a loading skeleton for the event search and filter area while results are being prepared.
  • Bug Fixes

    • Improved event loading behavior when search, mode, or tag filters are applied.
    • Added a shorter database connection timeout to help avoid long waits when the backend is unavailable.

@vercel

vercel Bot commented Jun 29, 2026

Copy link
Copy Markdown

@Ashitosh0302 is attempting to deploy a commit to the niharika-mente's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 1699ce08-4f8d-402b-a52a-fa4404e124e1

📥 Commits

Reviewing files that changed from the base of the PR and between 37e0efd and 2d3fa08.

📒 Files selected for processing (2)
  • app/page.tsx
  • lib/mongodb.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • lib/mongodb.ts
  • app/page.tsx

📝 Walkthrough

Walkthrough

This PR modifies app/page.tsx to await searchParams before calling getAllEvents with query/mode/tag filters, destructures events from the result, and wraps the SearchFilters UI in a Suspense boundary with a skeleton fallback. Separately, lib/mongodb.ts adds a serverSelectionTimeoutMS option to mongoose.connect.

Changes

Home page wiring and MongoDB timeout config

Layer / File(s) Summary
Home page Suspense boundary and searchParams wiring
app/page.tsx
Imports Suspense, awaits searchParams into resolvedParams, calls getAllEvents with query, mode, tag, destructures events from the result, and wraps the SearchFilters bar in a Suspense boundary with a skeleton fallback.
MongoDB connection timeout
lib/mongodb.ts
Adds serverSelectionTimeoutMS: 5000 to the options passed to mongoose.connect.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested labels: Medium

Suggested reviewers: SatyamPandey-07

🚥 Pre-merge checks | ✅ 1 | ❌ 4

❌ Failed checks (3 warnings, 1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning The PR changes page rendering and Mongo timeout settings, but it does not implement the clear filters behavior in #114. Add the Clear Filters control and logic to reset active filter query state while preserving the user's position.
Out of Scope Changes check ⚠️ Warning Adding serverSelectionTimeoutMS in lib/mongodb.ts is unrelated to #114's clear-filter behavior. Remove the MongoDB timeout tweak unless it is required by the clear-filters feature or documented in the issue.
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description keeps the template but leaves the summary, testing, and checklist mostly unfilled. Add a concrete change summary, the fixed issue number, test steps/results, and complete the checklist items.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title is short and clearly points to the home page event rendering fix.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
app/page.tsx (1)

20-24: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Pass sortBy through on the home page.

SearchFilters renders a sort dropdown that writes sortBy to the URL, but this page ignores it when calling getAllEvents, so sorting appears broken on the home page.

Proposed fix
 interface PageProps {
   searchParams: Promise<{
     query?: string;
     mode?: string;
     tag?: string;
+    sortBy?: string;
   }>;
 }
+
+const VALID_SORT = ["date_asc", "date_desc", "name_asc", "name_desc", "popularity"] as const;
+type SortByType = (typeof VALID_SORT)[number];
 
 const Page = async ({ searchParams }: PageProps) => {
   const resolvedParams = await searchParams;
+  const rawSortBy = resolvedParams.sortBy?.trim();
+  const sortBy = VALID_SORT.includes(rawSortBy as SortByType)
+    ? (rawSortBy as SortByType)
+    : undefined;
 
   const { events } = await getAllEvents({
     query: resolvedParams.query,
     mode: resolvedParams.mode,
     tag: resolvedParams.tag,
+    sortBy,
   });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/page.tsx` around lines 20 - 24, The home page is dropping the `sortBy`
query value when calling `getAllEvents`, so the `SearchFilters` sort dropdown
has no effect. Update the `app/page.tsx` data-fetching logic to read
`resolvedParams.sortBy` and pass it through alongside `query`, `mode`, and `tag`
in the `getAllEvents` call, keeping the existing `SearchFilters` URL state and
`getAllEvents` behavior aligned.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@lib/actions/event.actions.ts`:
- Around line 41-43: In the event pagination flow inside the event actions logic
(the safePage/safeLimit/skip calculation used by the event listing/count path),
the page is being used to compute skip before it is clamped against the actual
total pages, which can produce an empty result set while exposing an
out-of-range currentPage. Reorder the flow so the total matching event count is
computed first, totalPages is derived, then currentPage/page is clamped to that
range, and only after that should skip be calculated and used by the event query
in the affected event listing methods.

In `@lib/mongodb.ts`:
- Line 63: The MongoDB client setup currently hard-codes a 5-second server
selection timeout, which should be configurable instead of fixed. Update the
connection options in mongodb.ts so the timeout value comes from a config/env
source used by the MongoDB bootstrap code, and keep the existing fallback
behavior if no override is provided. Make sure the change is applied where the
MongoDB client is created so callers like getAllEvents and
getSimilarEventsBySlug can benefit from a tunable timeout during slow startup or
failover scenarios.

---

Outside diff comments:
In `@app/page.tsx`:
- Around line 20-24: The home page is dropping the `sortBy` query value when
calling `getAllEvents`, so the `SearchFilters` sort dropdown has no effect.
Update the `app/page.tsx` data-fetching logic to read `resolvedParams.sortBy`
and pass it through alongside `query`, `mode`, and `tag` in the `getAllEvents`
call, keeping the existing `SearchFilters` URL state and `getAllEvents` behavior
aligned.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 89dafd90-8e55-48d2-9654-d781acfa7d2d

📥 Commits

Reviewing files that changed from the base of the PR and between 05b48c2 and 37e0efd.

📒 Files selected for processing (4)
  • app/page.tsx
  • lib/actions/event.actions.ts
  • lib/mongodb.ts
  • tsconfig.json

Comment thread lib/actions/event.actions.ts Outdated
Comment thread lib/mongodb.ts
@TarunyaProgrammer

Copy link
Copy Markdown
Collaborator

@Ashitosh0302, Write a proper PR title and description!

@Ashitosh0302

Copy link
Copy Markdown
Contributor Author

I make the changes and add fix issues in the PR

@Ashitosh0302

Ashitosh0302 commented Jul 1, 2026 via email

Copy link
Copy Markdown
Contributor Author

@SatyamPandey-07

Copy link
Copy Markdown
Collaborator

This branch has conflicts that must be resolved
Use the web editor or the command line to resolve conflicts before continuing.

app/page.tsx
lib/actions/event.actions.ts @Ashitosh0302

@Ashitosh0302

Copy link
Copy Markdown
Contributor Author

I solved the merge conflicts all

@Ashitosh0302

Ashitosh0302 commented Jul 1, 2026 via email

Copy link
Copy Markdown
Contributor Author

@SatyamPandey-07 SatyamPandey-07 self-requested a review July 2, 2026 12:26
@SatyamPandey-07 SatyamPandey-07 merged commit 2a860ab into niharika-mente:main Jul 2, 2026
4 of 5 checks passed
@Ashitosh0302

Ashitosh0302 commented Jul 2, 2026 via email

Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Easy SSoC26 TO CONTRIBUTE

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants