Open MarcusDelvecchio opened 3 weeks ago
Thanks for the issue!
When passing a function to children
, react-aria
uses a WeakMap to cache the rendering, which is why you can't pass a list of string. However, using Array.map
should work as expected.
https://github.com/adobe/react-spectrum/blob/db51509aada412327191b3f03b06449977b309f7/packages/%40react-aria/collections/src/useCachedChildren.ts#L38-L40
NextUI Version
2.4.6
Describe the bug
Just spent a huge amount of time debugging an issue when trying to provide a list of IDs/strings to an autocomplete component and battling this mysterious error. The items prop can apparently be any iterable, but this is not the case and it cannot be an array of strings. I think it would be helpful to fix this or provide a more accurate error message for the AutoComplete component.
The following doesn't work: rendering the items from a list of ids and then using said IDs to render the items.
But the following does work: converting the ids to a list of objects and then using them to render the items.
Keep in mind I am working with a dictionary of {id: value} pairs.
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
Expected behavior
As I user, when passing in an iterable array of string to to the AutoComplete items / defaultItems prop, an error should no longer be thrown so that I can use those items to render my AutoCompleteItems, or a more clear error/documentation should be provided to indicate that this should not be done.
Screenshots or Videos
Operating System Version
macOS
Browser
Safari