Skip to content

Fiddle: correction for child keys in markdown component#229

Merged
krishan711 merged 1 commit into
mainfrom
fixmkd
Nov 30, 2025
Merged

Fiddle: correction for child keys in markdown component#229
krishan711 merged 1 commit into
mainfrom
fixmkd

Conversation

@krishan711
Copy link
Copy Markdown
Contributor

Description

Screenshots:

Checklist:

  • I have updated the CHANGELOG with a summary of my changes
  • I have updated the documentation accordingly

Copilot AI review requested due to automatic review settings November 30, 2025 12:51
Copy link
Copy Markdown
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 fixes React key prop warnings in the Markdown component by ensuring all children in the MarkdownBulletText component have proper keys. The changes add the index parameter to the map function and use it as a fallback when child.key is not available.

Key Changes:

  • Added index parameter to React.Children.toArray().map() callback
  • Used index as the key for string children and as a fallback (child.key ?? index) for React element children

Comment on lines +82 to +84
return React.cloneElement(child, { isInline: true, key: child.key ?? index });
}
return React.cloneElement(child, { key: child.key });
return React.cloneElement(child, { key: child.key ?? index });
Copy link

Copilot AI Nov 30, 2025

Choose a reason for hiding this comment

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

The eslint-disable-next-line react/no-array-index-key comment is only applied to line 77, but lines 82 and 84 also use index as a fallback for the key prop. For consistency, either apply the same eslint-disable comment to these lines or remove it from line 77 if using index as a fallback is acceptable throughout this function.

Copilot uses AI. Check for mistakes.
@krishan711 krishan711 merged commit 904f44d into main Nov 30, 2025
10 checks passed
@krishan711 krishan711 deleted the fixmkd branch November 30, 2025 12:54
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.

2 participants