Skip to content

fix(Collections): handle falsy keys properly#9993

Merged
reidbarber merged 2 commits into
mainfrom
fix-truthy-key-checks
Apr 28, 2026
Merged

fix(Collections): handle falsy keys properly#9993
reidbarber merged 2 commits into
mainfrom
fix-truthy-key-checks

Conversation

@reidbarber
Copy link
Copy Markdown
Member

@reidbarber reidbarber commented Apr 28, 2026

Closes #9991

In several places we were treating a key of 0 or "" as missing due to checking truthiness instead of nullishness.

✅ Pull Request Checklist:

  • Included link to corresponding React Spectrum GitHub Issue.
  • Added/updated unit tests and storybook for this change (for new code or code which already has tests).
  • Filled out test instructions.
  • Updated documentation (if it already exists for this component).
  • Looked at the Accessibility Practices for this feature - Aria Practices

📝 Test Instructions:

Unit tests should cover.

🧢 Your Project:

@rspbot
Copy link
Copy Markdown

rspbot commented Apr 28, 2026

yihuiliao
yihuiliao previously approved these changes Apr 28, 2026
Copy link
Copy Markdown
Member

@LFDanLu LFDanLu left a comment

Choose a reason for hiding this comment

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

LGTM, but mind adding some tests around rows with falsy keys attached to them so we don't regress in the future?

@rspbot
Copy link
Copy Markdown

rspbot commented Apr 28, 2026

@reidbarber reidbarber enabled auto-merge April 28, 2026 19:05
Copy link
Copy Markdown
Member

@snowystinger snowystinger left a comment

Choose a reason for hiding this comment

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

That was a lot of places, we really need a lint rule or ts plugin to catch those more

@reidbarber reidbarber added this pull request to the merge queue Apr 28, 2026
Merged via the queue into main with commit 3666c66 Apr 28, 2026
30 checks passed
@reidbarber reidbarber deleted the fix-truthy-key-checks branch April 28, 2026 20:20
@yihuiliao yihuiliao added the no testing Does not require manual testing during testing session label Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no testing Does not require manual testing during testing session RAC ready for review S2 small review Easy to review PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TreeCollection no longer allows a 0 (zero) or falsy key value

5 participants