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: unique key error #946

Merged
merged 1 commit into from
Feb 9, 2024
Merged

fix: unique key error #946

merged 1 commit into from
Feb 9, 2024

Conversation

lxsmnsyc
Copy link
Collaborator

@lxsmnsyc lxsmnsyc commented Feb 5, 2024

Fixes the unintentional unique key error thrown by React because of block

Copy link

vercel bot commented Feb 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
million-kitchen-sink ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2024 5:37am
sink ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 5, 2024 5:37am

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this pull request! A maintainer will review it soon.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 7780067223

  • -11 of 11 (0.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 3.617%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/react/compiled-block.ts 0 2 0.0%
packages/react/block.ts 0 9 0.0%
Totals Coverage Status
Change from base Build 7772235127: 0.0%
Covered Lines: 884
Relevant Lines: 27073

💛 - Coveralls

const vnode = createElement(Fragment, {}, marker, createElement(Effect, {
effect,
deps: hmrTimestamp ? [hmrTimestamp] : [],
}), children);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible that portals (children) won't have a key and the warning would be shown again?

What I'd suggest is that you spread the children by , ...children, so this way the whole error would be removed.

}), ...children);

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spreading might hit the arguments bound because it has a lower bound than arrays.

@aidenybai aidenybai merged commit 4126ada into main Feb 9, 2024
8 checks passed
@aidenybai aidenybai deleted the fix-unique-key branch February 9, 2024 08:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Warning: Each child in a list should have a unique "key" prop.
4 participants