Skip to content

Commit 08e0c82

Browse files
Fix build errors and warnings
- Fix optional chain expression errors in DownloadedScriptsTab, ScriptsGrid, and colorUtils - Fix React hooks dependency warnings in InstalledScriptsTab - Update useCallback dependency array to include containerStatusMutation - Update useEffect dependency array to include fetchContainerStatuses - Build now passes successfully with no errors or warnings
1 parent e3fccca commit 08e0c82

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/app/_components/DownloadedScriptsTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ export function DownloadedScriptsTab({ onInstallScript }: DownloadedScriptsTabPr
385385
);
386386
}
387387

388-
if (!downloadedScripts || downloadedScripts.length === 0) {
388+
if (!downloadedScripts?.length) {
389389
return (
390390
<div className="text-center py-12">
391391
<div className="text-muted-foreground">

src/app/_components/InstalledScriptsTab.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ export function InstalledScriptsTab() {
322322
if (serverIds.length > 0) {
323323
containerStatusMutation.mutate({ serverIds });
324324
}
325-
}, []);
325+
}, [containerStatusMutation]);
326326

327327
// Run cleanup when component mounts and scripts are loaded (only once)
328328
useEffect(() => {
@@ -337,7 +337,7 @@ export function InstalledScriptsTab() {
337337
if (scripts.length > 0) {
338338
fetchContainerStatuses();
339339
}
340-
}, [scripts.length]); // Only depend on scripts.length to prevent infinite loops
340+
}, [scripts.length, fetchContainerStatuses]);
341341

342342
const scriptsWithStatus = scripts.map(script => ({
343343
...script,

src/app/_components/ScriptsGrid.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ export function ScriptsGrid({ onInstallScript }: ScriptsGridProps) {
571571
);
572572
}
573573

574-
if (!scriptsWithStatus || scriptsWithStatus.length === 0) {
574+
if (!scriptsWithStatus?.length) {
575575
return (
576576
<div className="text-center py-12">
577577
<div className="text-muted-foreground">

src/lib/colorUtils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* to ensure optimal readability based on luminance
44
*/
55
export function getContrastColor(hexColor: string): 'black' | 'white' {
6-
if (!hexColor || hexColor.length !== 7 || !hexColor.startsWith('#')) {
6+
if (!hexColor?.length || hexColor.length !== 7 || !hexColor.startsWith('#')) {
77
return 'black'; // Default to black for invalid colors
88
}
99

0 commit comments

Comments
 (0)