From 1d441e42f53e520584944ff3a2b3901173cb486f Mon Sep 17 00:00:00 2001 From: "shakespeare.diy" Date: Tue, 14 Oct 2025 22:24:01 -0500 Subject: [PATCH] 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. --- src/components/git/PullRequestDialog.tsx | 28 ++++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/components/git/PullRequestDialog.tsx b/src/components/git/PullRequestDialog.tsx index 557d7558..ec72296c 100644 --- a/src/components/git/PullRequestDialog.tsx +++ b/src/components/git/PullRequestDialog.tsx @@ -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 {