Navigation Menu

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

Prevent keepUnusedDataFor values from overflowing setTimeout counter #2595

Merged
merged 1 commit into from Aug 14, 2022

Conversation

markerikson
Copy link
Collaborator

@markerikson markerikson commented Aug 14, 2022

Fixes #2535

Turns out setTimeout counters, which are in milliseconds, are normally stored in a 32-bit counter. So, 24.8 days is the longest you can safely provide (the usual 2.1 billion number, etc), otherwise it wraps and ends up executing immediately instead - oops!

Clamped it to be a max of 1s less, and also a min of 0.

@phryneas
Copy link
Member

Maybe with that knowledge, we should also allow for some kind of "keep indefinitely" option with Math.INFINITE or just -1?

@netlify
Copy link

netlify bot commented Aug 14, 2022

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

Name Link
🔨 Latest commit e67b93d
🔍 Latest deploy log https://app.netlify.com/sites/redux-starter-kit-docs/deploys/62f8692e9ec8570009135f68
😎 Deploy Preview https://deploy-preview-2595--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.

@codesandbox-ci
Copy link

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 e67b93d:

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

@markerikson
Copy link
Collaborator Author

Added a note to #2593 to add Math.INFINITE checks, as that task will need to rework timer behavior anyway.

@markerikson markerikson merged commit dc673a3 into master Aug 14, 2022
@markerikson markerikson deleted the bugfix/settimeout-max-value branch August 14, 2022 03:25
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.

RTK-Query - keepUnusedDataFor has problems with very high values
2 participants