Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Adding key to inner slot in Stack component #33578

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading