Skip to content

README uses anti-pattern of calling action from client #22

@greaber

Description

@greaber

Hi! The README show using kickoffExampleAction to kick off the action retrier and then poll for its status. But wouldn't it be better to use a mutation to schedule the action and then a query to get updates on its status? As the Actions docs say, "In most cases calling an action directly from a client is an anti-pattern. Instead, have the client call a mutation which captures the user intent by writing into the database and then schedules an action"

Also, this is more a comment on the Actions docs than these docs, but maybe in 90% of cases the best way to implement the recommendation would actually be to use the action retrier component and in the rest of cases usually the best approach would be to use the workflow component? I'm a noob, so maybe this is wrong. But if it is right, maybe the docs should say this. And in any case, maybe they could say that you shouldn't usually define any public actions, just internal actions. (Or maybe this is too strong because the action retrier adds overhead. But then the docs should be honest about when to used naked actions. Maybe when they don't mutate any state but just get data from convex and external APIs, and it is OK if they fail, they are pretty safe.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions