remove tokenId from useNotificationsUrlGenerator#174
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent 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 (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThe notification URL hook no longer uses Redux auth; it always builds websocket URLs from getWsBase() plus constants. api-ws was simplified to re-export API types and provide getWsBase() only. App and AppTopBar now select ChangesNotification URL Generation Simplification
🚥 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 |
sBouzols
left a comment
There was a problem hiding this comment.
Code review OK
Tests OK
Console warning check OK
… into prevent-refetch-on-silent-renew
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/App/App.tsx (1)
70-80:⚠️ Potential issue | 🟠 Major | ⚡ Quick winGuard config notification handling behind
userProfile.After this PR, notification URLs are generated even when no user is authenticated, but this callback still calls
fetchConfigParameter(...)unconditionally. That means config websocket events can now trigger unauthorized fetches on the login screen or right after logout, producing 401s and snackbar noise.Suggested fix
const updateConfig = useCallback( (event: MessageEvent) => { + if (userProfile === null) { + return; + } const eventData = JSON.parse(event.data); if (eventData?.headers?.parameterName) { fetchConfigParameter(APP_NAME, eventData.headers.parameterName) .then((param) => updateParams([param])) .catch((error) => snackWithFallback(snackError, error, { headerId: 'paramsRetrievingError' })); } }, - [updateParams, snackError] + [updateParams, snackError, userProfile] );🤖 Prompt for 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. In `@src/components/App/App.tsx` around lines 70 - 80, The updateConfig callback currently calls fetchConfigParameter unconditionally on incoming websocket events; guard this behavior by checking that userProfile exists (is authenticated) before invoking fetchConfigParameter so we don't trigger unauthorized fetches after logout or on the login screen. Modify the updateConfig function to first verify userProfile (or equivalent auth flag) and only call fetchConfigParameter(APP_NAME, eventData.headers.parameterName) and subsequently updateParams(...) when userProfile is truthy; keep the existing error handling via snackWithFallback(snackError, ...) unchanged when the guarded call runs.
🤖 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.
Outside diff comments:
In `@src/components/App/App.tsx`:
- Around line 70-80: The updateConfig callback currently calls
fetchConfigParameter unconditionally on incoming websocket events; guard this
behavior by checking that userProfile exists (is authenticated) before invoking
fetchConfigParameter so we don't trigger unauthorized fetches after logout or on
the login screen. Modify the updateConfig function to first verify userProfile
(or equivalent auth flag) and only call fetchConfigParameter(APP_NAME,
eventData.headers.parameterName) and subsequently updateParams(...) when
userProfile is truthy; keep the existing error handling via
snackWithFallback(snackError, ...) unchanged when the guarded call runs.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 2ca73c02-c7e2-42f4-b29a-ae704f7d15d6
📒 Files selected for processing (2)
src/components/App/App.tsxsrc/components/App/AppTopBar.tsx
sBouzols
left a comment
There was a problem hiding this comment.
Code Review OK
Tests OK
Console warning check OK
|



PR Summary
remove tokenId from useNotificationsUrlGenerator
needs gridsuite/commons-ui#1102