Skip to content

Commit

Permalink
chore: Adding key to inner slot in Stack component (#33578)
Browse files Browse the repository at this point in the history
  • Loading branch information
khmakoto authored Jan 7, 2025
1 parent 384df0c commit 8f76392
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "chore: Adding key to inner slot in Stack component.",
"packageName": "@fluentui/react",
"email": "Humberto.Morimoto@microsoft.com",
"dependentChangeType": "patch"
}
5 changes: 4 additions & 1 deletion packages/react/src/components/Stack/Stack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/** @jsx withSlots */
import * as React from 'react';
import { withSlots, createComponent, getSlots } from '@fluentui/foundation-legacy';
import { useId } from '@fluentui/react-hooks';
import { css, getNativeProps, htmlElementProperties, warnDeprecations } from '../../Utilities';
import { styles, GlobalClassNames as StackGlobalClassNames } from './Stack.styles';
import { StackItem } from './StackItem/StackItem';
Expand All @@ -26,6 +27,8 @@ const StackView: IStackComponent['view'] = props => {
padding: 'tokens.padding',
});

const stackInnerId = useId('stack-inner');

const stackChildren = _processStackChildren(props.children, {
disableShrink,
enableScopedSelectors,
Expand All @@ -42,7 +45,7 @@ const StackView: IStackComponent['view'] = props => {
if (wrap) {
return (
<Slots.root {...nativeProps}>
<Slots.inner>{stackChildren}</Slots.inner>
<Slots.inner key={stackInnerId}>{stackChildren}</Slots.inner>
</Slots.root>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ exports[`TeachingBubble renders renders with hasCloseIcon which is deprecated 1`
margin-right: 4px;
margin-top: 0;
}
id="id__3"
id="id__4"
>
Test Primary Button
</span>
Expand Down Expand Up @@ -481,7 +481,7 @@ exports[`TeachingBubble renders renders with hasCloseIcon which is deprecated 1`
margin-right: 4px;
margin-top: 0;
}
id="id__6"
id="id__7"
>
Test Secondary Button
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ exports[`TeachingBubble renders TeachingBubbleContent with buttons correctly 1`]
margin-right: 4px;
margin-top: 0;
}
id="id__3"
id="id__4"
>
Test Primary Button
</span>
Expand Down Expand Up @@ -765,7 +765,7 @@ exports[`TeachingBubble renders TeachingBubbleContent with buttons correctly 1`]
margin-right: 4px;
margin-top: 0;
}
id="id__6"
id="id__7"
>
Test Secondary Button
</span>
Expand Down

0 comments on commit 8f76392

Please sign in to comment.