react-jobs icon indicating copy to clipboard operation
react-jobs copied to clipboard

Need to abort an old work when a new work started

Open dehypnosis opened this issue 8 years ago • 1 comments

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

dehypnosis avatar Nov 24 '17 13:11 dehypnosis

Apologies I have been out of action for so long. I will be reviewing this soon. Thanks for raising this issue!

ctrlplusb avatar Mar 14 '18 20:03 ctrlplusb