+
Skip to content

can not call DataSource function during an action #720

Open
@linchen2chris

Description

@linchen2chris

During an action if we want call another action in turn, we can use xxActions.yy.defer()
But if During an action I want to call DataSource function, it will give error "cannot dispatch during an action"

How can I call DataSource function during an action?

The context is
I have a submit button, it should submit data by calling DataSource function, but before submit I wanna validate the data. so when click button, I send an action set the submitted flag and validate all data, if no error, I will call api to submit the data, if has error, won't call submit.

But I got error, Dispatch.dispatch(...): Cannot dispatch in the middle of a dispatch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载