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

ApiProvider: correctly register listeners, allow to disable listeners #2277

Merged
merged 1 commit into from
Jul 2, 2022

Conversation

phryneas
Copy link
Member

As mentioned in #2003, might even be worth to put it into a 1.8 patch depending how long we want to wait until 1.9.

@phryneas phryneas added the bug Something isn't working label Apr 24, 2022
@phryneas phryneas added this to the 1.8 milestone Apr 24, 2022
@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 24, 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 a5551ee:

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

@netlify
Copy link

netlify bot commented Apr 24, 2022

Deploy Preview for redux-starter-kit-docs ready!

Name Link
🔨 Latest commit a5551ee
🔍 Latest deploy log https://app.netlify.com/sites/redux-starter-kit-docs/deploys/62c0ac91783214000709d882
😎 Deploy Preview https://deploy-preview-2277--redux-starter-kit-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Comment on lines +48 to +54
useEffect(
(): undefined | (() => void) =>
props.setupListeners === false
? undefined
: setupListeners(store.dispatch, props.setupListeners),
[props.setupListeners]
)
Copy link
Member

Choose a reason for hiding this comment

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

Hmmm, do we need to rework setupListeners and initialized make sure we're cleaning up the subscriptions here if we're putting it in an effect?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, that's a good point. Especially with React 18 double-running effects in dev.

Copy link
Member Author

Choose a reason for hiding this comment

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

setupListeners returns an unsubscribe function so this should be fine as it is.

@markerikson markerikson modified the milestones: 1.8, 1.9 May 22, 2022
@markerikson
Copy link
Collaborator

Let's put this in master now.

@markerikson markerikson force-pushed the pr/fix-apiprovider-listeners branch from 5ac9cf1 to a5551ee Compare July 2, 2022 20:37
@markerikson markerikson merged commit ee86c42 into master Jul 2, 2022
@markerikson markerikson deleted the pr/fix-apiprovider-listeners branch July 2, 2022 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants