Skip to content

Conversation

@ggilmore
Copy link
Contributor

As per your README.md, itemToString can be called with a null Item.

function(item: any) | defaults to: i => (i == null ? '' : String(i))

This PR fixes your typings to reflect that.

itemToString can be called with a null item
@kentcdodds kentcdodds merged commit bcf7d60 into downshift-js:master Jul 13, 2018
@ggilmore
Copy link
Contributor Author

ggilmore commented Jul 13, 2018

Thanks for merging this so quickly! Do you have an idea of when the next release will be?

kentcdodds pushed a commit that referenced this pull request Jul 13, 2018
There was an issue with a patch release, so this manual-releases.md
change is to release a new patch version. I think the issue is related
to my tokens all being deleted. I've updated the token so it should
work this time.

Reference: #505
@kentcdodds
Copy link
Member

It's been published just now! :)

@ggilmore
Copy link
Contributor Author

👍 Thanks!

Rendez pushed a commit to Rendez/downshift that referenced this pull request Sep 30, 2018
itemToString can be called with a null item
Rendez pushed a commit to Rendez/downshift that referenced this pull request Sep 30, 2018
There was an issue with a patch release, so this manual-releases.md
change is to release a new patch version. I think the issue is related
to my tokens all being deleted. I've updated the token so it should
work this time.

Reference: downshift-js#505
kimroen added a commit to kimroen/downshift that referenced this pull request Jun 8, 2020
This makes it so the argument passed to `itemToString` can be `null` for the following interfaces:

- `UseSelectProps`
- `UseComboboxProps`
- `Actions`

This makes them behave in line with various documentation, which states that they can receive null:

- [`useCombobox#itemToString`](https://github.com/downshift-js/downshift/tree/master/src/hooks/useCombobox#itemtostring)
- [`useSelect#itemToString`](https://github.com/downshift-js/downshift/tree/master/src/hooks/useSelect#itemtostring)
- [Downshift component](https://github.com/downshift-js/downshift#itemtostring)

I didn’t touch `useMultipleSelection`, because its documentation didn’t have this line: [`useMultipleSelection#itemToString`](https://github.com/downshift-js/downshift/tree/master/src/hooks/useMultipleSelection#itemtostring)

I was also not sure about `itemToString` passed to the various `A11y`-functions, so I didn’t touch these either.

This fix has previously been applied to the main Downshift component: downshift-js#505

This will be a breaking change for people using typescript with `strictNullChecks` turned on if they don’t already check for null. I will leave that decision with you, though.
silviuaavram pushed a commit that referenced this pull request Jun 27, 2020
This makes it so the argument passed to `itemToString` can be `null` for the following interfaces:

- `UseSelectProps`
- `UseComboboxProps`
- `Actions`

This makes them behave in line with various documentation, which states that they can receive null:

- [`useCombobox#itemToString`](https://github.com/downshift-js/downshift/tree/master/src/hooks/useCombobox#itemtostring)
- [`useSelect#itemToString`](https://github.com/downshift-js/downshift/tree/master/src/hooks/useSelect#itemtostring)
- [Downshift component](https://github.com/downshift-js/downshift#itemtostring)

I didn’t touch `useMultipleSelection`, because its documentation didn’t have this line: [`useMultipleSelection#itemToString`](https://github.com/downshift-js/downshift/tree/master/src/hooks/useMultipleSelection#itemtostring)

I was also not sure about `itemToString` passed to the various `A11y`-functions, so I didn’t touch these either.

This fix has previously been applied to the main Downshift component: #505

This will be a breaking change for people using typescript with `strictNullChecks` turned on if they don’t already check for null. I will leave that decision with you, though.
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.

2 participants