Skip to content

Need to abort an old work when a new work started #45

@dehypnosis

Description

@dehypnosis

Hey! really appreciate to your hard work.
I met a problem with a withJobbed component when got a new work while the component already proceeding a job

scenario is like below:

  • a work promise A started => state: { completed: false }
  • the component received new props
  • new work promise B started => state: { completed: false }
  • the old work promise A threw an error => state: { completed: true, error: {..} }
  • an error component is mounted
  • new work promise B finished =>state: { completed: true, data: {..}, error: {..} }
  • ErrorComponent will be mounted in result

maybe another scenario can be like below:

  • a work promise A started => state: { completed: false }
  • the component received new props
  • new work promise B started => state: { completed: false }
  • new work promise B finished =>state: { completed: true, data: {..} }
  • the old work promise A finished => state: { completed: true, data: {.. overriden} }
  • a old job's data will be shown in result

I think it need to abort the old job or handle as abandoned when got a new job
Thanks in advance

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions