RM40477: improving-data-test-ids-for-actions#109
RM40477: improving-data-test-ids-for-actions#109alexluca06 wants to merge 3 commits intomaster-flower-platformfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the reliability and flexibility of Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a key property for context menu actions to allow for stable identifiers, which is a good improvement for testability and React's rendering logic. The implementation correctly computes the key from the new property. However, I've noticed an inconsistency where actions using renderInMenu do not use this new stable key for React's key prop. This could lead to rendering bugs and should be addressed.
| <Menu className="rct9k-context-menu" secondary vertical> | ||
| {visibleActions.map((action: IAction) => { | ||
| const key = visibleActions.indexOf(action); | ||
| const key = (action.key instanceof Function ? action.key({ ...this.props.paramsForAction }) : action.key) || visibleActions.indexOf(action); |
There was a problem hiding this comment.
While this new logic for key is a great improvement for generating stable identifiers, it's not applied consistently. For actions that use renderInMenu (the else branch of the ternary operator on line 97), the React key prop is still being assigned the item's index (visibleActions.indexOf(action)) on line 112. This should be updated to use the new key variable to ensure consistent behavior and prevent potential rendering issues with React.
For example, line 112 should be changed to:
: React.cloneElement(action.renderInMenu({ ...this.props.paramsForAction, closeContextMenu: this.close }), { key: key, "data-testid": testids.menuItem + "_" + key })
Proposed Change:
What is your change
Change type
Put an
xin the boxes that applyChecklist