Skip to content

Commit 7c752a8

Browse files
committed
chore(docs): Use unique keys in examples
1 parent e1092d3 commit 7c752a8

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

packages/module/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithActions.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import ChatbotConversationHistoryNav, {
55
} from '@patternfly/chatbot/dist/dynamic/ChatbotConversationHistoryNav';
66
import { Checkbox, DropdownItem, DropdownList } from '@patternfly/react-core';
77

8-
const menuItems = [
9-
<DropdownList key="list-1">
8+
const generateMenuItems = (id: string) => [
9+
<DropdownList key={`header-drawer-with-actions-example-conversation-${id}-dropdown`}>
1010
<DropdownItem value="Download" id="Download">
1111
Download
1212
</DropdownItem>
@@ -23,29 +23,29 @@ const menuItems = [
2323
];
2424

2525
const conversations: { [key: string]: Conversation[] } = {
26-
Today: [{ id: '1', text: 'Red Hat products and services', menuItems }],
26+
Today: [{ id: '1', text: 'Red Hat products and services', menuItems: generateMenuItems('1') }],
2727
'This month': [
2828
{
2929
id: '2',
3030
text: 'Enterprise Linux installation and setup',
31-
menuItems
31+
menuItems: generateMenuItems('2')
3232
},
33-
{ id: '3', text: 'Troubleshoot system crash', menuItems }
33+
{ id: '3', text: 'Troubleshoot system crash', menuItems: generateMenuItems('3') }
3434
],
3535
March: [
36-
{ id: '4', text: 'Ansible security and updates', menuItems },
37-
{ id: '5', text: 'Red Hat certification', menuItems },
38-
{ id: '6', text: 'Lightspeed user documentation', menuItems }
36+
{ id: '4', text: 'Ansible security and updates', menuItems: generateMenuItems('4') },
37+
{ id: '5', text: 'Red Hat certification', menuItems: generateMenuItems('5') },
38+
{ id: '6', text: 'Lightspeed user documentation', menuItems: generateMenuItems('6') }
3939
],
4040
February: [
41-
{ id: '7', text: 'Crashing pod assistance', menuItems },
42-
{ id: '8', text: 'OpenShift AI pipelines', menuItems },
43-
{ id: '9', text: 'Updating subscription plan', menuItems },
44-
{ id: '10', text: 'Red Hat licensing options', menuItems }
41+
{ id: '7', text: 'Crashing pod assistance', menuItems: generateMenuItems('7') },
42+
{ id: '8', text: 'OpenShift AI pipelines', menuItems: generateMenuItems('8') },
43+
{ id: '9', text: 'Updating subscription plan', menuItems: generateMenuItems('9') },
44+
{ id: '10', text: 'Red Hat licensing options', menuItems: generateMenuItems('10') }
4545
],
4646
January: [
47-
{ id: '11', text: 'RHEL system performance', menuItems },
48-
{ id: '12', text: 'Manage user accounts', menuItems }
47+
{ id: '11', text: 'RHEL system performance', menuItems: generateMenuItems('11') },
48+
{ id: '12', text: 'Manage user accounts', menuItems: generateMenuItems('12') }
4949
]
5050
};
5151

packages/module/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotHeaderDrawerWithSelection.tsx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import ChatbotConversationHistoryNav, {
55
} from '@patternfly/chatbot/dist/dynamic/ChatbotConversationHistoryNav';
66
import { Checkbox, DropdownItem, DropdownList } from '@patternfly/react-core';
77

8-
const menuItems = [
9-
<DropdownList key="list-1">
8+
const generateMenuItems = (id: string) => [
9+
<DropdownList key={`header-drawer-with-selections-example-conversation-${id}-dropdown`}>
1010
<DropdownItem value="Download" id="Download">
1111
Download
1212
</DropdownItem>
@@ -29,29 +29,29 @@ export const ChatbotHeaderDrawerWithSelection: FunctionComponent = () => {
2929
const displayMode = ChatbotDisplayMode.embedded;
3030

3131
const conversations: { [key: string]: Conversation[] } = {
32-
Today: [{ id: '1', text: 'Red Hat products and services', menuItems }],
32+
Today: [{ id: '1', text: 'Red Hat products and services', menuItems: generateMenuItems('1') }],
3333
'This month': [
3434
{
3535
id: '2',
3636
text: 'Enterprise Linux installation and setup',
37-
menuItems
37+
menuItems: generateMenuItems('2')
3838
},
39-
{ id: '3', text: 'Troubleshoot system crash', menuItems }
39+
{ id: '3', text: 'Troubleshoot system crash', menuItems: generateMenuItems('3') }
4040
],
4141
March: [
42-
{ id: '4', text: 'Ansible security and updates', menuItems },
43-
{ id: '5', text: 'Red Hat certification', menuItems },
44-
{ id: '6', text: 'Lightspeed user documentation', menuItems }
42+
{ id: '4', text: 'Ansible security and updates', menuItems: generateMenuItems('4') },
43+
{ id: '5', text: 'Red Hat certification', menuItems: generateMenuItems('5') },
44+
{ id: '6', text: 'Lightspeed user documentation', menuItems: generateMenuItems('6') }
4545
],
4646
February: [
47-
{ id: '7', text: 'Crashing pod assistance', menuItems },
48-
{ id: '8', text: 'OpenShift AI pipelines', menuItems },
49-
{ id: '9', text: 'Updating subscription plan', menuItems },
50-
{ id: '10', text: 'Red Hat licensing options', menuItems }
47+
{ id: '7', text: 'Crashing pod assistance', menuItems: generateMenuItems('7') },
48+
{ id: '8', text: 'OpenShift AI pipelines', menuItems: generateMenuItems('8') },
49+
{ id: '9', text: 'Updating subscription plan', menuItems: generateMenuItems('9') },
50+
{ id: '10', text: 'Red Hat licensing options', menuItems: generateMenuItems('10') }
5151
],
5252
January: [
53-
{ id: '11', text: 'RHEL system performance', menuItems },
54-
{ id: '12', text: 'Manage user accounts', menuItems }
53+
{ id: '11', text: 'RHEL system performance', menuItems: generateMenuItems('11') },
54+
{ id: '12', text: 'Manage user accounts', menuItems: generateMenuItems('12') }
5555
]
5656
};
5757

packages/module/patternfly-docs/content/extensions/chatbot/examples/UI/ChatbotMessageBarAttach.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export const ChatbotMessageBarDefaultAttachExample: FunctionComponent = () => {
6666
};
6767

6868
const initialMenuItems = [
69-
<DropdownList key="list-1">
69+
<DropdownList key="message-bar-attach-menu-items">
7070
<DropdownItem className="pf-chatbot-source-details-dropdown-item" value="auth-operator Pod" id="0">
7171
<SourceDetailsMenuItem
7272
icon={
@@ -93,7 +93,7 @@ export const ChatbotMessageBarDefaultAttachExample: FunctionComponent = () => {
9393
/>
9494
</DropdownItem>
9595
</DropdownList>,
96-
<DropdownGroup key="group2">
96+
<DropdownGroup key="message-bar-attach-dropdown-group">
9797
<DropdownList>
9898
<DropdownItem value="Alerts" id="1" icon={<BellIcon />}>
9999
Alerts

0 commit comments

Comments
 (0)