mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Fix double-clone error
This commit is contained in:
1 file changed
+4
-2
+4
-2
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user