react-jobs
react-jobs copied to clipboard
Need to abort an old work when a new work started
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
Apologies I have been out of action for so long. I will be reviewing this soon. Thanks for raising this issue!