Skip to content

Commit

Permalink
Merge pull request #2523 from headlamp-k8s/auth-intial-state-fix
Browse files Browse the repository at this point in the history
frontend AuthChooser: Fix incorrect UI flashing
  • Loading branch information
joaquimrocha authored Nov 5, 2024
2 parents ab42a07 + 134d2e5 commit 6c915aa
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion frontend/src/components/authchooser/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function AuthChooser({ children }: AuthChooserProps) {
const location = useLocation();
const clusters = useClustersConf();
const dispatch = useDispatch();
const [testingAuth, setTestingAuth] = React.useState(false);
const [testingAuth, setTestingAuth] = React.useState(true);
const [error, setError] = React.useState<Error | null>(null);
const { from = { pathname: createRouteURL('cluster') } } = (location.state ||
{}) as ReactRouterLocationStateIface;
Expand Down Expand Up @@ -71,6 +71,10 @@ function AuthChooser({ children }: AuthChooserProps) {
}
const clusterName = getCluster();

// Reset the testing auth state just to prevent the early return from this function
// without actually testing auth, which would cause the auth chooser to never show up.
setTestingAuth(false);

if (!clusterName || !clusters || sameClusters || error || numClusters === 0) {
return;
}
Expand Down

0 comments on commit 6c915aa

Please sign in to comment.