Fix MSAL popup loading full app — skip React render when in popup context

MSAL parent polls popup URL for auth code (same-origin), so the popup
doesn't need to render anything. Prevents app from opening inside popup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Vadym Samoilenko 2026-03-20 14:35:25 +00:00
parent 2154ce946d
commit 3943be1c51

View file

@ -2,4 +2,9 @@ import { createRoot } from 'react-dom/client'
import App from './App.tsx'
import './index.css'
createRoot(document.getElementById("root")!).render(<App />);
// If loaded inside an MSAL popup, don't render the app.
// The parent window's MSAL instance polls the popup URL for the auth code
// and processes it — no React needed here.
if (window.opener === null || window.opener === window) {
createRoot(document.getElementById("root")!).render(<App />);
}