Skip to content

Conversation

@chakrihacker
Copy link
Contributor

@chakrihacker chakrihacker commented Jan 28, 2026

Changes

Please describe both what is changing and why this is important. Include:

Added Tanstack Query for the following hooks

my-organization

  • use-config
  • use-idp-config
  • use-organization-details-edit

domains

  • use-domain-table-query

Testing

Please describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and tests should be added for new functionality and existing tests should complete without errors.

  • This change adds unit test coverage
  • This change has been tested on the latest version of the platform/language or why not

Checklist

@codecov-commenter
Copy link

codecov-commenter commented Jan 28, 2026

Codecov Report

❌ Patch coverage is 97.97468% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.62%. Comparing base (12a3855) to head (42add98).
⚠️ Report is 28 commits behind head on main.

Files with missing lines Patch % Lines
packages/react/src/providers/query-provider.tsx 93.65% 4 Missing ⚠️
...rc/hooks/my-organization/config/use-idp-config.tsx 93.75% 2 Missing ⚠️
...ct/src/hooks/my-organization/config/use-config.tsx 96.66% 1 Missing ⚠️
...zation-management/use-organization-details-edit.ts 98.59% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #66      +/-   ##
==========================================
+ Coverage   83.62%   85.62%   +1.99%     
==========================================
  Files         125      127       +2     
  Lines       10320    10738     +418     
  Branches     1092     1325     +233     
==========================================
+ Hits         8630     9194     +564     
+ Misses       1690     1544     -146     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chakrihacker chakrihacker changed the title feat(react): add tanstack Layer for caching feat(react): add tanstack layer for caching Jan 28, 2026
@chakrihacker chakrihacker self-assigned this Jan 28, 2026
@chakrihacker chakrihacker added enhancement New feature or request Gen AI Indicates that the most of the code in this PR were generated or assisted by generative AI tools. labels Jan 28, 2026
@github-actions
Copy link

github-actions bot commented Jan 28, 2026

🚀 Preview deployment

Branch: refs/pull/66/merge
Commit: fb387f9

📝 Preview URL: https://auth0-universal-components-ckpg12x5w-okta.vercel.app


Updated at 2026-01-29T14:29:26.630Z

@rax7389 rax7389 marked this pull request as ready for review January 28, 2026 15:56
* Time in milliseconds until inactive cached data is garbage collected.
*
* When a query has no active observers (no mounted components using it):
* - Data remains in cache for this duration
Copy link
Contributor

Choose a reason for hiding this comment

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

too many inline comments reduces code readability , can we please reduce it

* Default cache configuration values.
*
* These defaults provide a balance between reducing API calls and keeping data fresh:
* - `staleTime: 30s` - Data is considered fresh for 30 seconds, avoiding redundant fetches
Copy link
Contributor

Choose a reason for hiding this comment

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

same here reduce inline comments


const CACHE_CONFIG = {
CONFIG_STALE_TIME: 5 * 60 * 1000,
CONFIG_GC_TIME: 10 * 60 * 1000,
Copy link
Contributor

@NaveenChand755 NaveenChand755 Jan 29, 2026

Choose a reason for hiding this comment

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

why are we defining cache config here again. ?

const queryState = queryClient.getQueryState(configQueryKeys.details());

// Only refetch if data is stale or doesn't exist
if (existingData && queryState && !queryState.isInvalidated) {
Copy link
Contributor

Choose a reason for hiding this comment

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

wont tanstack already do this via staleTime and refetch()

retry: (failureCount, error) => {
// Don't retry on 404 errors (config not set)
if (hasApiErrorBody(error) && error.body?.status === 404) {
return false;
Copy link
Contributor

Choose a reason for hiding this comment

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

shoudl we set data to null here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

below there is a line where we decide if data is there or not and return null based on that
const idpConfig = idpConfigQuery.data ?? null;

Comment on lines 123 to 125
const errorMessage =
error instanceof Error
? t('organization_changes_error_message', { message: error.message })
Copy link
Contributor

Choose a reason for hiding this comment

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

I see we already already generating error msg in try do we need to have this again here?

Copy link
Contributor

Choose a reason for hiding this comment

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

looks like this is still unresolved, to more context you see from line 49 we already have error handler with toast, but again we are creating the similar error notification with toast, can we reduce the redundant part here? I know its been part of existing code itself

@rax7389 rax7389 mentioned this pull request Jan 30, 2026
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request Gen AI Indicates that the most of the code in this PR were generated or assisted by generative AI tools.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants