Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 39a15974bd
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const trustedHosts = new Set([window.location.hostname, "login.microsoftonline.com"]); | ||
| const isTrustedRedirect = | ||
| parsedLogoutUrl.protocol === "https:" && trustedHosts.has(parsedLogoutUrl.hostname); |
There was a problem hiding this comment.
Include Keycloak issuer in trusted logout redirects
The new redirect filter only trusts window.location.hostname and login.microsoftonline.com, but /api/auth/federated-logout returns a Keycloak issuer logout URL whenever AUTH_PROVIDER is not Entra (the route even defaults to Keycloak). In that common path, resolveSafeRedirectUrl always falls back to /, so users are signed out locally but never sent to the IdP logout endpoint, leaving SSO sessions active and causing immediate re-login behavior on next sign-in.
Useful? React with 👍 / 👎.
| children, | ||
| initialLocale = defaultLocale, | ||
| }) => { | ||
| const [locale, setLocaleState] = useState<Locale>(() => readStoredLocale() ?? initialLocale); |
There was a problem hiding this comment.
Keep hydration locale aligned with server-provided locale
Initializing locale from localStorage before initialLocale can desynchronize SSR and CSR when users already have a stored locale but no admin-locale cookie yet (or a stale cookie). In that case the server renders with initialLocale from cookies while the client hydrates with the stored locale, causing translation/dir mismatch during hydration; since the cookie is only written in setLocale, this can repeat on every hard reload until the user manually changes language.
Useful? React with 👍 / 👎.
Motivation
Description
RootLayoutasync and read theadmin-localecookie vianext/headers, set<html lang>and<html dir>and passinitialLocaleintoLanguageProviderto avoid hydration mismatch (src/app/layout.tsx).LanguageProviderto acceptinitialLocale, readlocalStorageonce during state initialization, and persist locale to bothlocalStorageand anadmin-localecookie (src/context/LanguageContext.tsx).supportedLocalesandisLocalehelpers insrc/i18n/index.tsto centralize locale validation.next/dynamic(SSR disabled) to keep devtools out of the normal production execution path (src/context/QueryContext.tsx).window.location.assignand falling back to/when unsafe (src/components/header/UserDropdown.tsx).Testing
npx eslint src/app/layout.tsx src/context/LanguageContext.tsx src/context/QueryContext.tsx src/components/header/UserDropdown.tsx src/i18n/index.tswhich succeeded for the modified files.npm run lintwhich still fails due to pre-existing unrelated lint issues elsewhere in the repo (e.g.no-explicit-any, React compiler warnings).npx tsc --noEmitwhich also fails due to unrelated type errors in existing components, so type-checking across the whole repo was not fully green.Codex Task