Skip to content

Commit ec99bf0

Browse files
committed
fix(dashboard): Resolve drag-and-drop and hooks type errors
Address TypeScript type errors in `Dashboard.tsx` related to event handler props. This also resolves a "Rules of Hooks" violation in `CategoryColorModal.tsx` by ensuring hooks are called unconditionally, preventing crashes when opening the color customization modal.
1 parent a9e9667 commit ec99bf0

File tree

4 files changed

+16
-11
lines changed

4 files changed

+16
-11
lines changed

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.8.1]
6+
7+
### Fixed
8+
- **CRITICAL:** Fixed a crash (React error #310) that occurred when opening the "Customize Color" modal for a category. This was caused by a violation of the Rules of Hooks.
9+
- Fixed several TypeScript type errors related to event handlers in the Dashboard component, improving code stability.
10+
511
## [0.8.0]
612

713
### Fixed
@@ -176,4 +182,4 @@ All notable changes to this project will be documented in this file.
176182
- Global settings for package manager and build commands.
177183
- **Electron Packaging:** Application is fully packaged for Windows, macOS, and Linux using Electron and esbuild.
178184
- **Automatic Updates:** Integrated `electron-updater` to automatically check for and install new versions from GitHub Releases.
179-
- **In-App Documentation Viewer:** Added an "Info Hub" to view the README, functional manual, technical manual, and this changelog directly within the application.
185+
- **In-App Documentation Viewer:** Added an "Info Hub" to view the README, functional manual, technical manual, and this changelog directly within the application.

components/Dashboard.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ const Dashboard: React.FC<DashboardProps> = (props) => {
148148
const isBeingDragged = draggedRepo?.repoId === repo.id;
149149
const indicator = dropIndicator?.repoId === repo.id && dropIndicator?.categoryId === categoryId ? dropIndicator : null;
150150
return (
151-
// FIX START: Remove wrapper div and pass props explicitly to RepositoryCard to fix type errors.
152151
<RepositoryCard
153152
key={repo.id}
154153
repository={repo}
@@ -157,8 +156,8 @@ const Dashboard: React.FC<DashboardProps> = (props) => {
157156
detailedStatus={props.detailedStatuses[repo.id] || null}
158157
branchInfo={props.branchLists[repo.id] || null}
159158
detectedExecutables={props.detectedExecutables[repo.id] || []}
160-
onDragStart={() => handleDragStart(repo.id, categoryId)}
161-
onDragEnd={() => { setDraggedRepo(null); setDropIndicator(null); }}
159+
onDragStart={(e) => handleDragStart(repo.id, categoryId)}
160+
onDragEnd={(e) => { setDraggedRepo(null); setDropIndicator(null); }}
162161
isBeingDragged={isBeingDragged}
163162
dropIndicatorPosition={indicator ? indicator.position : null}
164163
onDragOver={(e) => handleDragOver(e, categoryId, repo.id)}
@@ -183,7 +182,6 @@ const Dashboard: React.FC<DashboardProps> = (props) => {
183182
setToast={props.setToast}
184183
onRefreshRepoState={props.onRefreshRepoState}
185184
/>
186-
// FIX END
187185
);
188186
})}
189187
</div>
@@ -285,4 +283,4 @@ const Dashboard: React.FC<DashboardProps> = (props) => {
285283
);
286284
};
287285

288-
export default Dashboard;
286+
export default Dashboard;

components/modals/CategoryColorModal.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ const PREDEFINED_THEMES = [
3333
const CategoryColorModal: React.FC<CategoryColorModalProps> = ({ isOpen, onClose, onSave, currentBgColor, currentTextColor }) => {
3434
const [bgColor, setBgColor] = useState(currentBgColor || '');
3535
const [textColor, setTextColor] = useState(currentTextColor || '');
36+
37+
// FIX: Hooks must be called unconditionally at the top level of the component.
38+
const customBgTooltip = useTooltip('Custom background color');
39+
const customTextTooltip = useTooltip('Custom text color');
3640

3741
if (!isOpen) {
3842
return null;
@@ -50,9 +54,6 @@ const CategoryColorModal: React.FC<CategoryColorModalProps> = ({ isOpen, onClose
5054
setBgColor(theme.bg);
5155
setTextColor(theme.text);
5256
};
53-
54-
const customBgTooltip = useTooltip('Custom background color');
55-
const customTextTooltip = useTooltip('Custom text color');
5657

5758

5859
return (

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "git-automation-dashboard",
3-
"version": "0.8.0",
3+
"version": "0.8.1",
44
"description": "A dashboard to manage and automate the workflow for a set of Git repositories.",
55
"main": "dist/main.js",
66
"author": "AI Assistant",
@@ -73,4 +73,4 @@
7373
}
7474
]
7575
}
76-
}
76+
}

0 commit comments

Comments
 (0)