website icon indicating copy to clipboard operation
website copied to clipboard

[BUG] RoadmapList component renders "0" when items array is empty

Open Sam-61s opened this issue 4 weeks ago • 4 comments

Describe the bug.

The RoadmapList component uses a problematic conditional rendering pattern that can cause the number "0" to be displayed on the page when the items array is empty.

Location: components/roadmap/RoadmapList.tsx

Problematic Code: return ( items && items.length && ( <ul className={className} data-testid='RoadmapList-list'> {/* ... */} ) );

Expected behavior

When the items array is empty or undefined, the component should render nothing (return null) instead of displaying "0".

if (!items || items.length === 0) return null;

return (

    {/* ... */}
); ```

This ensures that:

  • No visual artifacts are displayed when there are no items
  • The code is more readable and follows React best practices
  • The intent is explicit and clear to other developers

Screenshots

Before Fix:

  • A "0" character appears on the roadmap page when the items array is empty

After Fix:

  • The component renders nothing (no visual output) when items array is empty

How to Reproduce

  1. Navigate to a roadmap page that uses the RoadmapList component
  2. Ensure the items prop passed to RoadmapList is an empty array [] or undefined
  3. Observe that the number "0" is rendered on the page

Code to reproduce: // In a component that uses RoadmapList <RoadmapList colorClass="some-class" items={[]} // Empty array />

🖥️ Device Information [optional]

  • Operating System (OS):
  • Browser:
  • Browser Version:

👀 Have you checked for similar open issues?

  • [x] I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes I am willing to submit a PR!

Sam-61s avatar Dec 17 '25 18:12 Sam-61s

Hey @princerajpoot20

Could you please assign this issue to me so I can create a PR? I'm ready to submit it once assigned. Thanks! 🙏

Sam-61s avatar Dec 17 '25 18:12 Sam-61s

Can i work on this issue ?

Dsp023 avatar Dec 18 '25 08:12 Dsp023

Hey @Dsp023 👋 Thanks for your interest! I’ve already requested assignment from the maintainer and am currently waiting for their approval. Once they respond, I'll proceed accordingly. Appreciate your understanding! 🙏

Sam-61s avatar Dec 18 '25 10:12 Sam-61s

Hi @Sam-61s👋 I’ve gone through this issue and understand the root cause and expected behavior. I’d love to work on this and submit a clean fix that aligns with the project’s existing patterns and best practices.

If this issue is still unassigned, please feel free to assign it to me. Happy to ask clarifying questions or adjust the solution based on maintainer feedback.

Thanks! 🙌

Ayush4958 avatar Dec 18 '25 11:12 Ayush4958