Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for cancellation before starting payloadCreator (might have been cancelled during async condition) #2918

Closed
phryneas opened this issue Nov 17, 2022 Discussed in #2914 · 1 comment · Fixed by #2965
Labels
enhancement New feature or request
Milestone

Comments

@phryneas
Copy link
Member

Discussed in #2914

Originally posted by KeisJS November 16, 2022
Hello. I abort thunk before the condition is resolved. But after resolving the condition, the thunk is still executed.

export const sampleThunk = createAsyncThunk('sampleThunk', async () => {
  console.log('do something async');
}, {
  condition: () => new Promise((res) => {
    setTimeout(() => res(true), 1000);
  }),
});
useEffect(() => {
    const sampleThunkAction = dispatch(sampleThunk());

    sampleThunkAction.abort();
  }, [dispatch]);

Is this a bug or feature?

@phryneas phryneas added the enhancement New feature or request label Nov 17, 2022
@markerikson markerikson added this to the 1.9.x milestone Nov 30, 2022
@markerikson
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants