Skip to content

Conversation

@codeunia-dev
Copy link
Owner

@codeunia-dev codeunia-dev commented Nov 23, 2025

Update caching strategy across API routes and configuration across API routes and configuration to prevent stale data, ensuring fresh responses for dynamic content.

Authored by: @akshay0611

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced data freshness across companies, events, hackathons, and leaderboard sections to prevent stale information from being displayed.
  • Performance & Infrastructure

    • Optimized static asset caching and updated cache control policies for improved content delivery.

✏️ Tip: You can customize this high-level summary in your review settings.

… to prevent stale data, ensuring fresh responses for dynamic content.
@vercel
Copy link

vercel bot commented Nov 23, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
codeunia Building Building Preview Comment Nov 23, 2025 4:34am

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 23, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

The PR removes server-side caching throughout the application to prevent serving stale data. Changes include disabling cache logic in multiple API routes, updating page rendering to force dynamic behavior, and refactoring cache header strategies in configuration files to use no-cache semantics instead of time-based caching.

Changes

Cohort / File(s) Summary
Page rendering configuration
app/[username]/page.tsx
Added Next.js export declarations (dynamic: 'force-dynamic', revalidate: 0, fetchCache: 'force-no-store') to enforce dynamic rendering and disable caching at the page level.
API route caching removal
app/api/companies/[slug]/route.ts, app/api/companies/route.ts, app/api/events/[slug]/route.ts, app/api/events/featured/route.ts, app/api/events/route.ts, app/api/hackathons/route.ts, app/api/leaderboard/route.ts
Removed client-side cache lookups and write operations from GET handlers. Changed response headers from caching strategies (API_STANDARD, DYNAMIC_CONTENT) to USER_PRIVATE (no-cache). All routes now fetch directly from database on each request.
Cache header configuration
next.config.ts
Removed Cache-Tag headers and specialized caching blocks. Consolidated cache rules with uniform Expires: 0 and must-revalidate semantics for dynamic pages. Updated API route block to enforce no-cache/no-store with max-age=0. Simplified header structure across static, media, and dynamic sections.
Vercel deployment configuration
vercel.json
Increased static asset cache duration from 30 to 365 days (max-age=31536000). Removed the separate cache-manifest.json caching rule block.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • next.config.ts: Significant refactoring with broad impact on caching policies across the entire application; requires careful verification that the new header rules maintain correct cache behavior for all route types.
  • API routes: Multiple similar changes across different endpoints; verify consistency in removal of cache logic and confirm USER_PRIVATE response headers are appropriate for all affected routes.
  • vercel.json: Verify the change to 365-day caching for static assets aligns with deployment strategy and doesn't conflict with next.config.ts rules.

Possibly related PRs

Poem

🐰 No more stale data cached in the warren,
Fresh data hops from the database, no delay!
Cache-Control headers now say "must-revalidate,"
Dynamic rendering keeps content in today,
A speedy, truthful burrow awaits! ✨

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/staledata

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c10601e and 9f1d8bb.

📒 Files selected for processing (10)
  • app/[username]/page.tsx (1 hunks)
  • app/api/companies/[slug]/route.ts (2 hunks)
  • app/api/companies/route.ts (1 hunks)
  • app/api/events/[slug]/route.ts (2 hunks)
  • app/api/events/featured/route.ts (1 hunks)
  • app/api/events/route.ts (1 hunks)
  • app/api/hackathons/route.ts (1 hunks)
  • app/api/leaderboard/route.ts (1 hunks)
  • next.config.ts (2 hunks)
  • vercel.json (1 hunks)

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 and usage tips.

@codeunia-dev codeunia-dev merged commit e99321b into main Nov 23, 2025
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants