Skip to content

Add support for returning a promise from a data provider function #314

Open
@acqajar

Description

@acqajar

Steps to reproduce:

  1. Here's my code below:
    <MentionsInput singlieLine={false} value={description.value} onChange ={this.handleChangeStoryDescription}> <Mention trigger="@" data={ this.fetchUsers } /> </MentionsInput>
  2. in the fetchUsers call, I have the following:
    fetchUsers = (query)=> { let users; console.log(query) if (!query) return axios.get(getUsers(query)).then( ({ data }) => { users = data.data.map((e, idx)=>{ let obj = { id: e._id, display: e.firstName + " " + e.lastName, } return obj }) return users // users is an array of objects formatted as per above }) .catch( ( error ) => { console.log( error ); }).then(function (users) { console.log(users) return users }); }
  3. My expectation is that the return of users to the this.fetchUsers function in the works as it does in this example - https://github.com/signavio/react-mentions/blob/master/demo/src/examples/AsyncGithubUserMentions.js. In other words, the data attribute in the should populate with the array of objects i.e. users

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions