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 Combobox hidden input default value causing React warnings (name prop) #6336

Merged
merged 5 commits into from
Jun 19, 2024

Conversation

sookmax
Copy link
Contributor

@sookmax sookmax commented May 6, 2024

Closes #6327

It just occurred to me that it might also be nice to update the type for selectedKey from Key to Key | null.
Should I include that as well? Or maybe it's better to address it when converting packages/@react-stately/list to TS strict later (I don't see it on the typescript-strict-plugin list in tsconfig.json).

export interface SingleSelectListState<T> extends ListState<T> {
/** The key for the currently selected item. */
readonly selectedKey: Key,
/** Sets the selected key. */
setSelectedKey(key: Key | null): void,
/** The value of the currently selected item. */
readonly selectedItem: Node<T>
}

✅ 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:

Story

🧢 Your Project:

Copy link
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.

Probably easier to address the ts strict separately, I suspect it'll be non-trivial. But if it's easy, then feel free to add it.

Would you mind adding a name to a combobox test? It'll log the warning and we fail the tests if any logs are in our output.

@sookmax
Copy link
Contributor Author

sookmax commented May 8, 2024

Probably easier to address the ts strict separately, I suspect it'll be non-trivial. But if it's easy, then feel free to add it.

I agree. I'll take a look later if I have some down times 😄

Would you mind adding a name to a combobox test? It'll log the warning and we fail the tests if any logs are in our output.

This is cool! I verified the React warnings result in test failures when the name prop was added and the fix was removed. And yes I added name to TestComboBox in ComboBox.test.js.

@lorenzo-dallamuta
Copy link

may I help in any way to proceed with the merge of this pr?

@snowystinger
Copy link
Member

@lorenzo-dallamuta shouldn't need anything, looks like we just didn't finish the review.

Copy link
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, verified the warning happening before no longer happens

@LFDanLu LFDanLu merged commit 81ecc5e into adobe:main Jun 19, 2024
26 checks passed
@dannify dannify removed the release label Aug 13, 2024
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.

ComboBox with name property - warnings in console.
6 participants