Fix double-clone error

This commit is contained in:
Alex Gleason committed 2025-09-23 19:12:48 -05:00
1 parent 22de6889d9
commit fe82f36533
1 file changed
+4 -2
+4 -2
View File
@@ -1,4 +1,4 @@
import { useState, useEffect, useCallback } from 'react';
import { useState, useEffect, useCallback, useRef } from 'react';
import { useNavigate, useSearchParams } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { AppLayout } from '@/components/AppLayout';
@@ -19,6 +19,7 @@ export default function Clone() {
const [searchParams] = useSearchParams();
const projectsManager = useProjectsManager();
const { toast } = useToast();
const autoCloneInitiatedRef = useRef(false);
useSeoMeta({
title: `${t('importRepository')} - Shakespeare`,
@@ -160,9 +161,10 @@ export default function Clone() {
// Initialize repoUrl from URL parameters and auto-import if URL is provided
useEffect(() => {
const urlParam = searchParams.get('url');
if (urlParam) {
if (urlParam && !autoCloneInitiatedRef.current) {
const decodedUrl = decodeURIComponent(urlParam);
setRepoUrl(decodedUrl);
autoCloneInitiatedRef.current = true;
// Automatically start the clone process with the URL directly
handleClone(decodedUrl);