Skip to content

Data fetching fixes on RFS page#236

Merged
mirhamasala merged 9 commits intomainfrom
cm/requests-for-startups-fixes
Feb 13, 2026
Merged

Data fetching fixes on RFS page#236
mirhamasala merged 9 commits intomainfrom
cm/requests-for-startups-fixes

Conversation

@CharlyMartin
Copy link
Collaborator

@CharlyMartin CharlyMartin commented Feb 12, 2026

📝 Description

This PR refactor RFS data fetching to use async/await with fast-glob.

🛠️ Key Changes

  • Make getMarkdownSlugs and readMarkdownFile async, replacing sync fs with fs/promises and fast-glob
  • Add try-catch error handling in [slug]/page.tsx with notFound() fallback
  • Add empty state rendering for open requests list in agents/page.tsx
  • Set dynamicParams = false for static generation of known slugs only
  • Simplify get-rfs-data.ts by extracting shared readRFSFile helper and removing verbose error logging
  • Refactor path-validation.ts: rename validateSlugAndGetPath to buildFilePath with object params, throw on invalid slugs instead of returning null

🧪 How to Test

  • Verify all RFS pages render correctly
  • Confirm 404 works for unknown slugs

🔖 Resources

@vercel
Copy link

vercel bot commented Feb 12, 2026

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

Project Deployment Actions Updated (UTC)
filecoin-cloud Ready Ready Preview, Comment Feb 13, 2026 11:30am

Request Review

@FilOzzy FilOzzy added this to FOC Feb 12, 2026
@github-project-automation github-project-automation bot moved this to 📌 Triage in FOC Feb 12, 2026
@CharlyMartin CharlyMartin marked this pull request as ready for review February 12, 2026 16:37
@rjan90 rjan90 moved this from 📌 Triage to 🔎 Awaiting review in FOC Feb 13, 2026
@mirhamasala mirhamasala requested a review from Copilot February 13, 2026 09:07
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors the Requests for Startups (RFS) data fetching to use async/await patterns with fast-glob for better performance and modern JavaScript practices. It converts synchronous file system operations to asynchronous ones, simplifies error handling, and adds static generation configuration.

Changes:

  • Migrated getMarkdownSlugs and readMarkdownFile to async/await using fs/promises and fast-glob
  • Refactored buildFilePath (renamed from validateSlugAndGetPath) to use object parameters and throw errors instead of returning null
  • Updated RFS data fetching functions to be async with simplified error handling
  • Added empty state rendering and async support to the agents page component
  • Configured dynamicParams = false for static-only route generation

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/utils/path-validation.ts Refactored validation function to use object parameters, renamed to buildFilePath, changed to throw errors instead of returning null
src/utils/markdown.ts Converted to async functions using fs/promises and fast-glob, removed security check and type exports
src/app/agents/utils/get-rfs-data.ts Made functions async, extracted readRFSFile helper, removed verbose error logging and try-catch blocks
src/app/agents/page.tsx Converted to async component, updated data access to use nested structure, added empty state conditional rendering
src/app/agents/[slug]/page.tsx Added try-catch error handling to page component, made metadata generation async, added dynamicParams = false configuration
package.json Added fast-glob dependency
package-lock.json Added fast-glob and related dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

CharlyMartin and others added 8 commits February 13, 2026 11:19
Updated package-lock.json to include fast-glob (^3.3.3) as a dev
dependency, along with its transitive dependencies like @nodelib/fs.*
and micromatch components, likely for improved file globbing in build
or tooling processes.
Replace synchronous fs.readdirSync with async fast-glob for better
non-blocking I/O in Next.js server components. Update all callers
(getRFSData, Agents page, and dynamic route) to use await for slugs
retrieval. This prevents event loop blocking during file system reads
in OPEN_REQUESTS_DIR.
…ty state

Refactor RFS pages to use async/await for data loading in Next.js server components,
improving reliability and UX. Wrap fetches in try-catch to log errors and invoke
notFound() on failures. Add conditional rendering for empty open requests list.
Set dynamicParams=false for static generation of known slugs. Update data access
in list mapping to use nested 'data' property.
Copy link
Collaborator

@mirhamasala mirhamasala left a comment

Choose a reason for hiding this comment

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

@CharlyMartin Thanks so much for working on this. It looks great.

We still seemed to have some type issues so I pushed this CR - please feel free to make any changes directly if needed and merge this when done. I also rebased the branch.

🚀

@github-project-automation github-project-automation bot moved this from 🔎 Awaiting review to ✔️ Approved by reviewer in FOC Feb 13, 2026
@github-actions github-actions bot added size/L and removed size/L labels Feb 13, 2026
@mirhamasala mirhamasala merged commit 9360f6b into main Feb 13, 2026
6 checks passed
@mirhamasala mirhamasala deleted the cm/requests-for-startups-fixes branch February 13, 2026 14:36
@github-project-automation github-project-automation bot moved this from ✔️ Approved by reviewer to 🎉 Done in FOC Feb 13, 2026
@github-actions github-actions bot added size/L and removed size/L labels Feb 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

2 participants