use useProfile instead of user - #889
Conversation
|
Warning Review limit reached
More reviews will be available in 59 minutes and 40 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
📝 WalkthroughWalkthroughAdds OIDC silent-renew support by caching IdP settings in localStorage, introducing a ChangesOIDC Silent Renew Feature
userProfile Selector Refactor
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/directory-content-dialog.tsx`:
- Line 383: The ParametersEditionDialogProps interface expects a prop named
`user` of type `User | null`, but the code is passing an incorrectly named
`userProfile` prop with potentially incorrect values. In
src/components/directory-content-dialog.tsx at lines 383, 399, 414, 429, 444,
459, and 475, change the prop name from `userProfile={userProfile}` to
`user={userProfile}` at each location. Ensure that the value being passed is the
complete User object (verify that `userProfile` variable refers to the full User
object and not just the profile property extracted from state.user) so that the
ParametersEditionDialog components receive the correct prop name and complete
User data structure they expect.
In `@src/index.tsx`:
- Around line 20-24: The pathname comparison in the if condition checking for
the silent-renew callback route fails when the URL has a trailing slash (e.g.,
/silent-renew-callback/), causing the full app to render instead of
SilentRenewApp. Normalize the pathname by removing any trailing slashes before
comparing it with the expected route string. Modify the condition that checks
window.location.pathname.endsWith('/silent-renew-callback') to first normalize
the pathname using a method like replaceAll or a regex pattern to remove
trailing slashes, ensuring the comparison works consistently regardless of
whether the URL includes a trailing slash.
In `@src/utils/rest-api.ts`:
- Around line 101-120: The fetchIdpSettings and getCachedIdpSettings functions
have two vulnerabilities: (1) the fetch response is not validated for success
status before caching, allowing error responses to be poisoned into cache, and
(2) localStorage access is unguarded and can throw exceptions, crashing the flow
before fallback logic executes. In fetchIdpSettings, add a check for res.ok
before calling .json() on the response, and wrap the localStorage.setItem call
in a try-catch block to prevent storage exceptions from aborting the flow. In
getCachedIdpSettings, wrap the localStorage.getItem call in a try-catch block so
that storage access errors gracefully fall through to the fetchIdpSettings
fallback rather than crashing the silent-renew path.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 25d8d0d5-8586-41f4-b6a8-86760f3dc380
📒 Files selected for processing (6)
src/components/app.tsxsrc/components/directory-content-dialog.tsxsrc/components/silent-renew-app.tsxsrc/components/tree-views-container.tsxsrc/index.tsxsrc/utils/rest-api.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/index.tsx (1)
19-24: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueOptional: parallelize independent dynamic imports.
The font, CSS, and yup-init imports are independent and could load concurrently. Keep the
core-jspolyfill first if app code depends on it; the rest can be awaited together viaPromise.allto shave startup latency on the main app path.♻️ Suggested change
await import('core-js/es/array/flat-map'); - await import('typeface-roboto'); - await import('./index.css'); - await import('./configure-yup-init'); - const { default: AppWrapper } = await import('./components/app-wrapper'); + await Promise.all([ + import('typeface-roboto'), + import('./index.css'), + import('./configure-yup-init'), + ]); + const { default: AppWrapper } = await import('./components/app-wrapper'); root.render(<AppWrapper />);
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/index.tsx`:
- Around line 15-24: The silent-renew entry path in src/index.tsx currently
returns before loading the Array.prototype.flatMap polyfill, so add the
core-js/es/array/flat-map import to the silent-renew branch as well, not just
the AppWrapper path. Update the startup flow around
window.location.pathname.endsWith(SILENT_RENEW_CALLBACK_PATH) and SilentRenew so
both routes load the same required polyfill before rendering.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a1c4997f-a5c1-49a7-aa0e-73406cba78d9
📒 Files selected for processing (7)
src/components/directory-content-dialog.tsxsrc/components/silent-renew.tsxsrc/components/tree-views-container.tsxsrc/index.tsxsrc/module-core-js-array-flat-map.d.tssrc/module-typeface-roboto.d.tssrc/utils/rest-api.ts
✅ Files skipped from review due to trivial changes (2)
- src/module-typeface-roboto.d.ts
- src/module-core-js-array-flat-map.d.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- src/components/tree-views-container.tsx
- src/components/directory-content-dialog.tsx
- src/utils/rest-api.ts
|



PR Summary
Context
On every OIDC silent renew, oidc-client-ts loads
/silent-renew-callbackinside ahidden iframe. Because
index.tsxalways rendered<AppWrapper />, the entireapplication was bootstrapped inside that iframe just to end up calling
signinSilentCallback(): Redux store,IntlProviderand all translations,AG Grid registration, MUI theme,
SnackbarProviderandNotificationsProvider.NotificationsProvideradditionally fetchedenv.jsonand opened a notificationWebSocket on each renewal — all of it pure overhead repeated at every token refresh.
Changes
index.tsx: branch on the pathname before rendering. On/silent-renew-callbackrender a new lightweight
SilentRenewApp; otherwise render<AppWrapper />as before.components/silent-renew-app.tsx: rebuilds theUserManagerviainitializeAuthenticationProd(..., isSilentRenew=true, ...)(same settings, samelocalStoragestate store, same Azure authority hack as the parent) and completesthe flow through commons-ui's
SilentRenewCallbackHandler.utils/rest-api.ts:fetchIdpSettingsnow caches the result inlocalStorage;added
getCachedIdpSettings, used only by the silent-renew path, which reads thatcache (no network) and falls back to a real fetch if it is missing/corrupted.
Result
Inside the silent-renew iframe, requests go from a full SPA boot
(
idpSettings.json+env.json+ WebSocket + app bundle execution) down to asingle
POST /token— the actual token exchange. No more spurious WebSocketreconnections triggered by the renewal iframe.
Testing
env.json, no longerre-fetches
idpSettings.json, and does not open a WebSocket — onlyPOST /tokenremains.notification WebSocket is not reconnected on each cycle.