mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 08:23:34 +00:00
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:
1 parent
3c889288f8
commit
1d441e42f5
1 file changed
+14
-14
@@ -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 {
|
||||
|
||||
Reference in new issue
Block a user