diff options
| author | Brandon Keiji <[email protected]> | 2025-05-14 00:12:04 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-05-13 17:12:04 -0700 |
| commit | 7116ab9c293f6b59ae8490b234dd99c72d5dd72b (patch) | |
| tree | f6100f40c257c728bfa5064cf4f3efc209fb72e7 /packages/cli/src/ui/hooks/useAppEffects.ts | |
| parent | d3303fd3a004ee816c2c498c2f7ffa51753afc07 (diff) | |
fix: pass startup warnings to app as prop (#342)
Diffstat (limited to 'packages/cli/src/ui/hooks/useAppEffects.ts')
| -rw-r--r-- | packages/cli/src/ui/hooks/useAppEffects.ts | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/packages/cli/src/ui/hooks/useAppEffects.ts b/packages/cli/src/ui/hooks/useAppEffects.ts deleted file mode 100644 index da1ab203..00000000 --- a/packages/cli/src/ui/hooks/useAppEffects.ts +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @license - * Copyright 2025 Google LLC - * SPDX-License-Identifier: Apache-2.0 - */ - -import { useEffect } from 'react'; -import fs from 'fs'; -import path from 'path'; -import os from 'os'; -import { getErrorMessage } from '@gemini-code/server'; - -const warningsFilePath = path.join(os.tmpdir(), 'gemini-code-cli-warnings.txt'); - -// Effect to handle startup warnings -export function useStartupWarnings( - setStartupWarnings: React.Dispatch<React.SetStateAction<string[]>>, -) { - useEffect(() => { - try { - if (fs.existsSync(warningsFilePath)) { - const warningsContent = fs.readFileSync(warningsFilePath, 'utf-8'); - setStartupWarnings( - warningsContent.split('\n').filter((line) => line.trim() !== ''), - ); - try { - fs.unlinkSync(warningsFilePath); - } catch { - setStartupWarnings((prev) => [ - ...prev, - `Warning: Could not delete temporary warnings file.`, - ]); - } - } - } catch (err: unknown) { - setStartupWarnings((prev) => [ - ...prev, - `Error checking/reading warnings file: ${getErrorMessage(err)}`, - ]); - } - }, [setStartupWarnings]); // Include setStartupWarnings in dependency array -} |
