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

Allow data function to return a promise #611

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

srmagura
Copy link

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

changeset-bot bot commented Jul 22, 2022

🦋 Changeset detected

Latest commit: ea8a670

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

@vercel
Copy link

vercel bot commented Jul 22, 2022

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)

@nikeee
Copy link

nikeee commented Jun 10, 2023

Any chance to get this merged?

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.

Add support for returning a promise from a data provider function
2 participants