From 134d2e5691093cb36b295a1e32f76f49caff768f Mon Sep 17 00:00:00 2001 From: Joaquim Rocha Date: Tue, 5 Nov 2024 16:57:21 +0000 Subject: [PATCH] frontend AuthChooser: Set testing auth as true by default 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 --- frontend/src/components/authchooser/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/authchooser/index.tsx b/frontend/src/components/authchooser/index.tsx index 9740d3807d..abc733b212 100644 --- a/frontend/src/components/authchooser/index.tsx +++ b/frontend/src/components/authchooser/index.tsx @@ -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(null); const { from = { pathname: createRouteURL('cluster') } } = (location.state || {}) as ReactRouterLocationStateIface; @@ -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; }