Skip to content

Commit

Permalink
avoid hanging after adding a user
Browse files Browse the repository at this point in the history
  • Loading branch information
Flaque committed Dec 8, 2024
1 parent fdc35b6 commit c588aed
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/lib/clusters/clusters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
syncKubeconfig,
} from "./kubeconfig.ts";
import yaml from "yaml";
import { Box, render, Text } from "ink";
import { Box, render, Text, useApp } from "ink";
import React from "react";
import { Row } from "../Row.tsx";
import { useCallback, useEffect, useRef, useState } from "react";
Expand Down Expand Up @@ -239,10 +239,16 @@ function UserAddedDisplay(props: {
username: string;
}) {
const [isReady, setIsReady] = useState(false);
const { exit } = useApp();

useEffect(() => {
const interval = setInterval(() => {
isCredentialReady(props.id).then(setIsReady);
isCredentialReady(props.id).then((ready) => {
setIsReady(ready);
setTimeout(() => {
exit();
}, 0);
});
}, 200);
return () => clearInterval(interval);
}, [props.id]);
Expand Down

0 comments on commit c588aed

Please sign in to comment.