containers / containers/podman.io

Missing React key prop when rendering meeting dropdown options

Open Beginner friendly
#575 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
108
Forks
188
Avg merge
9d 15h
Merged PRs (30d)
11

Description

## What happened

In `src/components/layout/CommunityMeetingsCardGrid/index.tsx`, `getDropdownOption` renders a list of elements from `.map()` without a `key` prop:

```tsx
function getDropdownOption(options: DropdownOptionProps[]) {
return options.map(option => );
}
```

React requires a stable `key` on each element produced by `.map()`. Without it:

- React logs the warning *"Each child in a list should have a unique 'key' prop."* in the console, and
- reconciliation falls back to index-based matching, which can lead to incorrect DOM/state reuse when the list changes (these dropdown items are also `shift()`-ed and re-rendered elsewhere in the component).

The rendered elements are later spread through `DropDown` (`{isOpen && props?.options.map(option => option)}`), so the missing key propagates to the actual list output.

## What you expected to happen

Each mapped `DropDownOption` should receive a unique, stable `key`, and no key warning should appear.

## Suggested fix

```tsx
function getDropdownOption(options: DropdownOptionProps[]) {
return options.map((option, index) => );
}
```

(or a more stable key derived from `option.date`). I'd be happy to open a PR.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in src/components/layout/CommunityMeetingsCardGrid/index.tsx and inspect getDropdownOption, then follow how its mapped options are passed through DropDown. Ensure each rendered DropDownOption has a unique, stable key, preferably based on the option data, and confirm the React missing-key warning no longer appears.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.