mirror of
https://github.com/Dictionarry-Hub/profilarr.git
synced 2026-01-22 10:51:02 +01:00
fix: Wait for dev mode request to finish before populating status container
This commit is contained in:
@@ -27,10 +27,11 @@ const SettingsPage = () => {
|
|||||||
const [showBranchModal, setShowBranchModal] = useState(false);
|
const [showBranchModal, setShowBranchModal] = useState(false);
|
||||||
const [loadingAction, setLoadingAction] = useState('');
|
const [loadingAction, setLoadingAction] = useState('');
|
||||||
const [statusLoading, setStatusLoading] = useState(true);
|
const [statusLoading, setStatusLoading] = useState(true);
|
||||||
|
const [devModeLoading, setDevModeLoading] = useState(true);
|
||||||
const [statusLoadingMessage, setStatusLoadingMessage] = useState('');
|
const [statusLoadingMessage, setStatusLoadingMessage] = useState('');
|
||||||
const [noChangesMessage, setNoChangesMessage] = useState('');
|
const [noChangesMessage, setNoChangesMessage] = useState('');
|
||||||
const [activeTab, setActiveTab] = useState('git'); // New state for tab navigation
|
const [activeTab, setActiveTab] = useState('git');
|
||||||
const tabsRef = useRef({}); // Ref for tabs
|
const tabsRef = useRef({});
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
fetchSettings();
|
fetchSettings();
|
||||||
@@ -38,12 +39,15 @@ const SettingsPage = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const checkDevModeStatus = async () => {
|
const checkDevModeStatus = async () => {
|
||||||
|
setDevModeLoading(true);
|
||||||
try {
|
try {
|
||||||
const response = await checkDevMode();
|
const response = await checkDevMode();
|
||||||
setIsDevMode(response.devMode);
|
setIsDevMode(response.devMode);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Error checking dev mode:', error);
|
console.error('Error checking dev mode:', error);
|
||||||
setIsDevMode(false);
|
setIsDevMode(false);
|
||||||
|
} finally {
|
||||||
|
setDevModeLoading(false);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -215,14 +219,16 @@ const SettingsPage = () => {
|
|||||||
|
|
||||||
{settings && (
|
{settings && (
|
||||||
<div className='space-y-4'>
|
<div className='space-y-4'>
|
||||||
{statusLoading ? (
|
{statusLoading || devModeLoading ? (
|
||||||
<div className='flex items-left justify-left dark:bg-gray-800 p-4 rounded-md border border-gray-200 dark:border-gray-700 text-sm'>
|
<div className='flex items-left justify-left dark:bg-gray-800 p-4 rounded-md border border-gray-200 dark:border-gray-700 text-sm'>
|
||||||
<Loader
|
<Loader
|
||||||
className='animate-spin mr-2'
|
className='animate-spin mr-2'
|
||||||
size={16}
|
size={16}
|
||||||
/>
|
/>
|
||||||
<span className='text-gray-300'>
|
<span className='text-gray-300'>
|
||||||
{statusLoadingMessage}
|
{statusLoading
|
||||||
|
? statusLoadingMessage
|
||||||
|
: 'Checking development mode...'}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
|||||||
Reference in New Issue
Block a user