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

Enable cancelling active listeners when unsubscribing #2078

Merged
merged 2 commits into from
Feb 27, 2022

Conversation

markerikson
Copy link
Collaborator

This PR:

  • Renames the removeAllListeners action creator to clearAllListeners
  • Updates the unsubscribe callbacks to optionally accept {cancelActive: true} to cancel active listeners
  • Updates the API doc to be more clear about cancellation behavior while unsubscribing
  • Updates the last couple @alpha type labels to be @public

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 27, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 5acc6ef:

Sandbox Source
Vanilla Configuration
Vanilla Typescript Configuration
rsk-github-issues-example Configuration
@examples-query-react/basic Configuration
@examples-query-react/advanced Configuration
@examples-action-listener/counter Configuration

@github-actions
Copy link

github-actions bot commented Feb 27, 2022

size-limit report 📦

Path Size
1. entry point: @reduxjs/toolkit (cjs.production.min.js) 14.54 KB (+0.24% 🔺)
1. entry point: @reduxjs/toolkit (esm.js) 12.38 KB (+0.3% 🔺)
1. entry point: @reduxjs/toolkit/query (cjs.production.min.js) 24.29 KB (+0.15% 🔺)
1. entry point: @reduxjs/toolkit/query (esm.js) 19.01 KB (0%)
1. entry point: @reduxjs/toolkit/query/react (cjs.production.min.js) 26.58 KB (+0.13% 🔺)
1. entry point: @reduxjs/toolkit/query/react (esm.js) 21.7 KB (0%)
2. entry point: @reduxjs/toolkit (without dependencies) (cjs.production.min.js) 7.33 KB (+0.46% 🔺)
2. entry point: @reduxjs/toolkit (without dependencies) (esm.js) 7.28 KB (+0.45% 🔺)
2. entry point: @reduxjs/toolkit/query (without dependencies) (cjs.production.min.js) 10.12 KB (0%)
2. entry point: @reduxjs/toolkit/query (without dependencies) (esm.js) 10.55 KB (0%)
2. entry point: @reduxjs/toolkit/query/react (without dependencies) (cjs.production.min.js) 2.8 KB (0%)
2. entry point: @reduxjs/toolkit/query/react (without dependencies) (esm.js) 3.21 KB (0%)
3. createSlice (esm.js) 5.08 KB (0%)
3. createEntityAdapter (esm.js) 6.44 KB (0%)
3. configureStore (esm.js) 5.82 KB (0%)
3. createApi (esm.js) 17.22 KB (0%)
3. createApi (react) (esm.js) 19.93 KB (0%)
3. fetchBaseQuery (esm.js) 11.6 KB (0%)
3. setupListeners (esm.js) 10.46 KB (0%)
3. ApiProvider (esm.js) 18.56 KB (0%)

@@ -478,6 +478,80 @@ describe('createListenerMiddleware', () => {
expect(effect.mock.calls).toEqual([[testAction1('a'), middlewareApi]])
})

test.only('can cancel an active listener when unsubscribing directly', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.only should be removed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DRAT thank you!

@markerikson markerikson force-pushed the feature/final-1.8-cleanup branch from 8c73422 to 115f950 Compare February 27, 2022 20:04
@markerikson markerikson force-pushed the feature/final-1.8-cleanup branch 2 times, most recently from 7f33584 to 6e70057 Compare February 27, 2022 20:16
@markerikson markerikson force-pushed the feature/final-1.8-cleanup branch from 6e70057 to 5acc6ef Compare February 27, 2022 20:25
@markerikson
Copy link
Collaborator Author

Awright. Merging, and releasing shortly!

@markerikson markerikson merged commit 7cdd615 into v1.8.0-integration Feb 27, 2022
@markerikson markerikson deleted the feature/final-1.8-cleanup branch February 27, 2022 20:34
@FaberVitale
Copy link
Contributor

Awright. Merging, and releasing shortly!

👍

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.

2 participants