Allow `data` function to return a promise
Fixes #314.
If the data function returns a Promise or other thenable, the suggestions are updated when the promise resolves.
The type definitions already have Promise as a valid return type for DataFunc, so this PR brings the actual functionality in line with what you would expect from the types.
I added tests for both types of async data functions, callback-based and promise-based.
I have the Prettier extension enabled and it made some formatting changes. If necessary, I can disable the extension and remake my changes so the diff is as small as possible.
🦋 Changeset detected
Latest commit: ea8a670e1e5e6cdfa7b3023fef41e6509550fb3a
The changes in this PR will be included in the next version bump.
This PR includes changesets to release 1 package
| Name | Type |
|---|---|
| react-mentions | Minor |
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Updated |
|---|---|---|---|
| react-mentions | ✅ Ready (Inspect) | Visit Preview | Jul 22, 2022 at 2:40PM (UTC) |
Any chance to get this merged?