Skip to content

Fix: add missing slugs to project entries to prevent /projects/undefi…#673

Merged
Zahnentferner merged 1 commit intoAOSSIE-Org:mainfrom
prathamkhatwani:fix-missing-project-slugs
Mar 16, 2026
Merged

Fix: add missing slugs to project entries to prevent /projects/undefi…#673
Zahnentferner merged 1 commit intoAOSSIE-Org:mainfrom
prathamkhatwani:fix-missing-project-slugs

Conversation

@prathamkhatwani
Copy link
Contributor

@prathamkhatwani prathamkhatwani commented Mar 15, 2026

Addressed Issues:

Fixes #672

Screenshots/Recordings:

Before:
image

After:
image

Additional Notes:

The issue occurred because several project objects in src/helper/projects.js did not include a slug property. Since the project pages use dynamic routing (/projects/[slug]), missing slugs caused navigation to /projects/undefined.

This PR fixes the issue by:

Adding missing slug fields to the affected project entries.

Ensuring all projects used in routing have valid slugs.

This prevents invalid routes from being generated and ensures all project cards navigate to the correct page.

AI Usage Disclosure:

Check one of the checkboxes below:

  • This PR does not contain AI-generated code at all.
  • This PR contains AI-generated code.

Checklist

  • My PR addresses a single issue, fixes a single bug or makes a single improvement.
  • My code follows the project's code style and conventions
  • If applicable, I have made corresponding changes or additions to documentation
  • If applicable, I have made corresponding changes or additions to tests
  • My changes generate no new warnings or errors

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced project routing stability with unique identifiers for each project.
    • Improved error handling in project metadata generation to gracefully handle missing or undefined identifiers, preventing potential crashes.

@coderabbitai
Copy link

coderabbitai bot commented Mar 15, 2026

📝 Walkthrough

Walkthrough

The PR fixes a navigation bug where clicking certain project cards redirected to /projects/undefined. It adds missing slug identifiers to six project objects and updates the dynamic route handler to safely filter undefined slugs and use optional chaining for comparisons.

Changes

Cohort / File(s) Summary
Dynamic Route Handler
src/app/projects/[slug]/page.jsx
Updated generateStaticParams to filter entries with missing or string "undefined" slug values. Enhanced generateMetadata to use optional chaining (?.) for slug comparisons to prevent errors from undefined values.
Project Data
src/helper/projects.js
Added slug field to six project entries: agora-blockchain, eduaid, openchat, resonate, monumento, and social-street-smart. Slug values provide stable identifiers for URL routing.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

Possibly related PRs

Suggested reviewers

  • Zahnentferner

Poem

🐰 A slug was missing, routes turned gray,
Projects pointing to undefined's way,
But now with slugs so crisp and clean,
The finest navigation's seen!
No more to /undefined we roam, 🛣️✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding missing slugs to project entries to fix undefined routing issues.
Linked Issues check ✅ Passed The PR successfully addresses issue #672 by adding slug properties to all project entries, enabling proper routing and eliminating the /projects/undefined navigation bug.
Out of Scope Changes check ✅ Passed All changes are directly scoped to fixing the undefined slug issue: adding slug fields to project data and updating routing logic to handle them safely.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

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.

Tip

CodeRabbit can approve the review once all CodeRabbit's comments are resolved.

Enable the reviews.request_changes_workflow setting to automatically approve the review once all CodeRabbit's comments are resolved.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (7)
src/helper/projects.js (6)

283-285: Fix inconsistent indentation/formatting in the object structure.

The slug and name properties have inconsistent indentation compared to other project entries. They should be indented to match the rest of the object properties (like description, link, etc.).

🧹 Proposed formatting fix
   {
-    
-  slug: 'agora-blockchain',
-  name: 'Agora Blockchain',
+    slug: 'agora-blockchain',
+    name: 'Agora Blockchain',
     description:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/helper/projects.js` around lines 283 - 285, Fix the inconsistent
indentation for the Agora Blockchain project object: align the `slug:
'agora-blockchain'` and `name: 'Agora Blockchain'` property lines to match the
same indentation level used by the other properties (e.g., `description`,
`link`) in the same object entry so the object's property alignment is
consistent.

328-329: Inconsistent indentation for slug and name properties.

Same formatting issue - properties lack proper indentation.

🧹 Proposed formatting fix
   {
-  slug: 'monumento',
-  name: 'Monumento',
+    slug: 'monumento',
+    name: 'Monumento',
     description:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/helper/projects.js` around lines 328 - 329, Fix the inconsistent
indentation of the object properties by aligning the properties inside the
project object literal (e.g., the properties "slug" and "name" in the Monumento
entry) to match the surrounding object indentation style; update the indentation
so each property is indented the same amount as the other properties in that
object to keep formatting consistent.

337-340: Inconsistent indentation and malformed object opening brace.

The object opening brace is on a separate line from the array comma, and the slug/name properties lack proper indentation.

🧹 Proposed formatting fix
-  
-    {
-  slug: 'social-street-smart',
-  name: 'Social Street Smart',
+  {
+    slug: 'social-street-smart',
+    name: 'Social Street Smart',
     description:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/helper/projects.js` around lines 337 - 340, Fix the malformed object
opening and inconsistent indentation in the projects array: move the opening
brace to the same line as the preceding comma (so the object starts with "{
slug: ..."), indent the properties (slug and name) to match the surrounding
objects, and ensure the closing brace and trailing comma follow the project's
existing formatting pattern; locate the object starting with the stray "{" and
adjust formatting in the projects array (e.g., the entry for
'social-street-smart').

316-319: Inconsistent indentation and malformed object opening brace.

The object opening brace is on a separate line from the array comma, and the slug/name properties lack proper indentation.

🧹 Proposed formatting fix
-  
-    {
-  slug: 'resonate',
-  name: 'Resonate',
+  {
+    slug: 'resonate',
+    name: 'Resonate',
     description:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/helper/projects.js` around lines 316 - 319, The object literal for the
project entry with slug 'resonate' / name 'Resonate' is misformatted: move the
opening brace up to the same line as the preceding comma and fix indentation so
the slug and name properties are indented to match other entries in the projects
array (the object containing slug: 'resonate' and name: 'Resonate' should follow
the same brace placement and property indentation style as the other project
objects in src/helper/projects.js).

297-298: Inconsistent indentation for slug and name properties.

Same formatting issue as above - properties lack proper indentation.

🧹 Proposed formatting fix
   {
-  slug: 'eduaid',
-  name: 'EduAid',
+    slug: 'eduaid',
+    name: 'EduAid',
     description:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/helper/projects.js` around lines 297 - 298, The object literal containing
the properties slug and name (e.g., slug: 'eduaid', name: 'EduAid') has
inconsistent indentation; fix by aligning these property lines with the
surrounding object formatting (match indentation used for other objects in the
file), ensuring the slug and name keys are indented the same as adjacent
properties and follow project object style used elsewhere (adjust in the object
where slug and name are defined).

307-308: Inconsistent indentation for slug and name properties.

Same formatting issue - properties lack proper indentation.

🧹 Proposed formatting fix
   {
-  slug: 'openchat',
-  name: 'OpenChat',
+    slug: 'openchat',
+    name: 'OpenChat',
     description:
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/helper/projects.js` around lines 307 - 308, The object for the OpenChat
project has inconsistent indentation for the slug and name properties; update
the formatting of the object containing slug: 'openchat' and name: 'OpenChat' so
those properties align with the surrounding object property indentation (match
the indentation style used by other project entries in the file, e.g., the same
number of spaces before "slug" and "name" in the projects array/object).
src/app/projects/[slug]/page.jsx (1)

36-39: Consider adding optional chaining for consistency with generateMetadata.

The ProductPage function accesses params.slug directly without optional chaining, whereas generateMetadata (Line 23) uses params?.slug. For consistency and defensive coding, consider applying the same pattern here.

🧹 Proposed consistency fix
 export default function ProductPage({ params }) {
   // Unwrapping params for Next.js 15+ if needed, but in 14 it's usually direct.
   // We'll treat it as synchronous access since it's an object in generateStaticParams context usually
-  const product = projects.find((p) => p.slug === params.slug);
+  const product = projects.find((p) => p?.slug === params?.slug);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/app/projects/`[slug]/page.jsx around lines 36 - 39, ProductPage accesses
params.slug directly which is inconsistent with generateMetadata's defensive
params?.slug; update ProductPage to use optional chaining when reading params
(e.g., use params?.slug) before passing into projects.find to avoid runtime
errors when params is undefined, and ensure any downstream logic (ProductPage
and the projects.find callback) handles a possibly undefined slug gracefully.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/app/projects/`[slug]/page.jsx:
- Around line 36-39: ProductPage accesses params.slug directly which is
inconsistent with generateMetadata's defensive params?.slug; update ProductPage
to use optional chaining when reading params (e.g., use params?.slug) before
passing into projects.find to avoid runtime errors when params is undefined, and
ensure any downstream logic (ProductPage and the projects.find callback) handles
a possibly undefined slug gracefully.

In `@src/helper/projects.js`:
- Around line 283-285: Fix the inconsistent indentation for the Agora Blockchain
project object: align the `slug: 'agora-blockchain'` and `name: 'Agora
Blockchain'` property lines to match the same indentation level used by the
other properties (e.g., `description`, `link`) in the same object entry so the
object's property alignment is consistent.
- Around line 328-329: Fix the inconsistent indentation of the object properties
by aligning the properties inside the project object literal (e.g., the
properties "slug" and "name" in the Monumento entry) to match the surrounding
object indentation style; update the indentation so each property is indented
the same amount as the other properties in that object to keep formatting
consistent.
- Around line 337-340: Fix the malformed object opening and inconsistent
indentation in the projects array: move the opening brace to the same line as
the preceding comma (so the object starts with "{ slug: ..."), indent the
properties (slug and name) to match the surrounding objects, and ensure the
closing brace and trailing comma follow the project's existing formatting
pattern; locate the object starting with the stray "{" and adjust formatting in
the projects array (e.g., the entry for 'social-street-smart').
- Around line 316-319: The object literal for the project entry with slug
'resonate' / name 'Resonate' is misformatted: move the opening brace up to the
same line as the preceding comma and fix indentation so the slug and name
properties are indented to match other entries in the projects array (the object
containing slug: 'resonate' and name: 'Resonate' should follow the same brace
placement and property indentation style as the other project objects in
src/helper/projects.js).
- Around line 297-298: The object literal containing the properties slug and
name (e.g., slug: 'eduaid', name: 'EduAid') has inconsistent indentation; fix by
aligning these property lines with the surrounding object formatting (match
indentation used for other objects in the file), ensuring the slug and name keys
are indented the same as adjacent properties and follow project object style
used elsewhere (adjust in the object where slug and name are defined).
- Around line 307-308: The object for the OpenChat project has inconsistent
indentation for the slug and name properties; update the formatting of the
object containing slug: 'openchat' and name: 'OpenChat' so those properties
align with the surrounding object property indentation (match the indentation
style used by other project entries in the file, e.g., the same number of spaces
before "slug" and "name" in the projects array/object).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 483f4d91-bbd0-45fc-bb09-90468748c140

📥 Commits

Reviewing files that changed from the base of the PR and between ade8066 and b6dd332.

📒 Files selected for processing (2)
  • src/app/projects/[slug]/page.jsx
  • src/helper/projects.js

Copy link
Collaborator

@Zahnentferner Zahnentferner left a comment

Choose a reason for hiding this comment

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

Thanks!

@Zahnentferner Zahnentferner merged commit 78f37ed into AOSSIE-Org:main Mar 16, 2026
1 check 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.

[BUG]: Clicking a project card navigates to /projects/undefined

2 participants