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

Fix warn of spreading key #127

Merged
merged 1 commit into from
Aug 29, 2024
Merged
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
10 changes: 6 additions & 4 deletions packages/react/src/float.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export interface FloatProps {
export function renderReferenceElement(
ReferenceNode: ReactElement,
componentProps: FloatReferenceProps & Required<Pick<FloatReferenceProps, 'as'>>,
attrs: Record<string, any>,
{ key, ...attrs }: Record<string, any>,
context: ReferenceState
) {
const { referenceRef } = context
Expand All @@ -146,6 +146,7 @@ export function renderReferenceElement(
if (props.as === Fragment) {
return (
<ReferenceNode.type
key={key}
{...ReferenceNode.props}
{...attrs}
ref={referenceRef}
Expand All @@ -155,7 +156,7 @@ export function renderReferenceElement(

const Wrapper = props.as || 'div'
return (
<Wrapper {...attrs} ref={referenceRef}>
<Wrapper key={key} {...attrs} ref={referenceRef}>
<ReferenceNode.type {...ReferenceNode.props} />
</Wrapper>
)
Expand All @@ -169,7 +170,7 @@ export type RenderFloatingElementProps =
export function renderFloatingElement(
FloatingNode: ReactElement,
componentProps: RenderFloatingElementProps,
attrs: Record<string, any>,
{ key, ...attrs }: Record<string, any>,
context: FloatingState
) {
const { floatingRef, props: rootProps, mounted, setShow, referenceHidden, escaped, placement, floatingStyles, referenceElWidth } = context
Expand Down Expand Up @@ -245,6 +246,7 @@ export function renderFloatingElement(
if (props.as === Fragment) {
return (
<FloatingNode.type
key={key}
{...FloatingNode.props}
{...nodeProps}
/>
Expand All @@ -253,7 +255,7 @@ export function renderFloatingElement(

const Wrapper = props.as || 'div'
return (
<Wrapper {...nodeProps}>
<Wrapper key={key} {...nodeProps}>
<FloatingNode.type {...FloatingNode.props} />
</Wrapper>
)
Expand Down
Loading