Fix circular dependency causing crash

Moved checkPermissionsAndFork definition before the useEffect that references it in the dependency array. This fixes the "Cannot access before initialization" error that was causing the Git Management dialog to crash.
This commit is contained in:
shakespeare.diy committed 2025-10-14 22:24:01 -05:00
1 parent 3c889288f8
commit 1d441e42f5
1 file changed
+14 -14
+14 -14
View File
@@ -115,20 +115,6 @@ export function PullRequestDialog({
}
}, [git, projectPath]);
useEffect(() => {
if (isOpen && remoteUrl) {
parseRemoteUrl(remoteUrl);
loadRemoteBranches();
}
}, [isOpen, remoteUrl, loadRemoteBranches]);
// Check permissions after remoteInfo is set
useEffect(() => {
if (remoteInfo && remoteUrl) {
checkPermissionsAndFork();
}
}, [remoteInfo, remoteUrl, checkPermissionsAndFork]);
const checkPermissionsAndFork = useCallback(async () => {
if (!remoteInfo || !remoteUrl) {
console.log('checkPermissionsAndFork: No remoteInfo or remoteUrl');
@@ -177,6 +163,20 @@ export function PullRequestDialog({
}
}, [remoteInfo, remoteUrl, settings.credentials]);
useEffect(() => {
if (isOpen && remoteUrl) {
parseRemoteUrl(remoteUrl);
loadRemoteBranches();
}
}, [isOpen, remoteUrl, loadRemoteBranches]);
// Check permissions after remoteInfo is set
useEffect(() => {
if (remoteInfo && remoteUrl) {
checkPermissionsAndFork();
}
}, [remoteInfo, remoteUrl, checkPermissionsAndFork]);
const parseRemoteUrl = (url: string) => {
setError(null);
try {