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

fix: use empty cancellation reason as default #32

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dankeboy36
Copy link

Let clients conveniently cancel the token without any reason.


The cancellation works very nicely. Thanks for the great work, Dennis!

This PR proposes an API change to let clients cancel the token without a reason.

Before:

useEffect(() => {
    const token = new CancellationTokenImpl();
    search(query, filter, token);
    return function () {
        token.cancel('');
    };
}, [search, filter, query]);

After:

useEffect(() => {
    const token = new CancellationTokenImpl();
    search(query, filter, token);
    return function () {
        token.cancel();
    };
}, [search, filter, query]);

Let clients cancel the token without any reason via a convenient way.

Signed-off-by: dankeboy36 <[email protected]>
it can be inferred from the default empty `string`

Signed-off-by: dankeboy36 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant