ConrabOpto / mst-query

Query library for mobx-state-tree
MIT License
110 stars 7 forks source link

Compatibility with mst-async-task #15

Closed vbylen closed 2 years ago

vbylen commented 2 years ago

Can I safely use mst-query with mst-async-task?

Thanks for creating a great library.

k-ode commented 2 years ago

Yes, it should work. However, you cannot replace run on a query or mutation with a mst-async-task.

k-ode commented 2 years ago

It's still experimental, but you can now use queries and mutations as properties just like tasks in mst-async-task.

const UserStore = types
    .model({
        getUser: types.optional(GetUserQuery, {}),
        updateUser: types.optional(UpdateUserMutation, {}),
    })
    .actions(self => ({
        afterCreate()  {
             self.getUser.run();
        }
    }):

It's available in mst-query@1.1.0-alpha.3