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

Update documentation comment for invalidationBehavior #4587

Open
cainePW opened this issue Aug 29, 2024 · 2 comments
Open

Update documentation comment for invalidationBehavior #4587

cainePW opened this issue Aug 29, 2024 · 2 comments

Comments

@cainePW
Copy link

cainePW commented Aug 29, 2024

It seems the default value invalidationBehavior does not accurately reflect the documentation comment.

The comment describes the default value as immediately.

Looking at the default set of options here it seems the default value is set to delayed.

const optionsWithDefaults: CreateApiOptions<any, any, any, any> = {
      reducerPath: 'api',
      keepUnusedDataFor: 60,
      refetchOnMountOrArgChange: false,
      refetchOnFocus: false,
      refetchOnReconnect: false,
      invalidationBehavior: 'delayed',
      ...options,
      extractRehydrationInfo,

...

If I understand this correctly, the comment needs to be updated. Apologies if I've got this wrong!

Thanks for your hard work on this library!

@Kluskey
Copy link

Kluskey commented Oct 18, 2024

+1. This can cause issues with listeners that need to immediately respond to fulfilled queries. I had a scenario where it created an odd discrepancy where an API request succeeded but in the listener logic, the state wasn't up to date because the cache tags hadn't been invalidated (yet, because they were delayed).

Good find on the comment, thank you!

@EskiMojo14
Copy link
Collaborator

Good spot - PRs welcome :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants