Skip to content

Commit

Permalink
frontend AuthChooser: Set testing auth as true by default
Browse files Browse the repository at this point in the history
We should only set the testing state as false when we go through the
testing. This prevents the case of the test happening so quickly that
the UI is rendered as never testing the auth, which means the options of
using a token are shown to the user when they are being redirected to
the actual cluster after a successful auth.

Signed-off-by: Joaquim Rocha <[email protected]>
  • Loading branch information
joaquimrocha committed Nov 5, 2024
1 parent bb54ef4 commit 74c9c6d
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 @@ -73,6 +73,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 74c9c6d

Please sign in to comment.