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

Overhaul caching / Add React-Query #35

Merged
merged 4 commits into from
May 3, 2024
Merged

Overhaul caching / Add React-Query #35

merged 4 commits into from
May 3, 2024

Conversation

jdgarcia
Copy link
Contributor

@jdgarcia jdgarcia commented May 1, 2024

Copy link
Contributor

@gitkrakel gitkrakel left a comment

Choose a reason for hiding this comment

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

Seems to work well here!

Copy link
Collaborator

@miggy-e miggy-e left a comment

Choose a reason for hiding this comment

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

LGTM, have a comment about default stale time

export const queryClient = new QueryClient({
defaultOptions: {
queries: {
gcTime: 1000 * 60 * 60 * 24, // 24 hours
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we set a staleTime default to non-zero to reduce extra calls from our provider library? (we use 10 seconds in the website)

Copy link
Contributor

@gitkrakel gitkrakel May 3, 2024

Choose a reason for hiding this comment

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

My main concern about caching is about getting updated provider connections from our APIs; if a user connects an integration and goes straight to the popup, I'd expect they would be able to grant permissions right away.

That being said I think a blanket rule of 10 seconds should be short enough 👍

Copy link
Contributor Author

@jdgarcia jdgarcia May 3, 2024

Choose a reason for hiding this comment

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

The only hook that uses the provider library currently actually already has a stale time set to 10 minutes (with immediate invalidation if the user clicks on one of the links, since there's a reasonable chance that the user may perform an action on the PR).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can still add a global 10 second stale time though

@jdgarcia jdgarcia merged commit baa0734 into main May 3, 2024
1 check passed
@jdgarcia jdgarcia deleted the react-query branch May 3, 2024 20:46
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.

3 participants