mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-01-31 20:03:37 +00:00
refactor: move logger initialization outside of useCliStatus function
- Moved the logger initialization to the top of the file for better readability and to avoid re-initialization on each function call. - This change enhances the performance and clarity of the code in the useCliStatus hook. - fix infinite loop calling caused by rerender because of logger
This commit is contained in:
@@ -7,6 +7,7 @@ interface UseCliStatusOptions {
|
||||
setCliStatus: (status: any) => void;
|
||||
setAuthStatus: (status: any) => void;
|
||||
}
|
||||
const logger = createLogger('CliStatus');
|
||||
|
||||
export function useCliStatus({
|
||||
cliType,
|
||||
@@ -15,7 +16,6 @@ export function useCliStatus({
|
||||
setAuthStatus,
|
||||
}: UseCliStatusOptions) {
|
||||
const [isChecking, setIsChecking] = useState(false);
|
||||
const logger = createLogger('CliStatus');
|
||||
|
||||
const checkStatus = useCallback(async () => {
|
||||
logger.info(`Starting status check for ${cliType}...`);
|
||||
|
||||
Reference in New Issue
Block a user