adasd
All checks were successful
Deploy / deploy-staging (push) Successful in 6s
Deploy / deploy-production (push) Has been skipped

This commit is contained in:
2026-06-03 00:43:33 +02:00
parent 66f9176ea8
commit 99cf5eaef2
3 changed files with 31 additions and 16 deletions

View File

@@ -5,7 +5,7 @@
}
const h = React.createElement;
const { useEffect, useMemo, useState } = React;
const { useEffect, useMemo, useRef, useState } = React;
const apiBase = root.dataset.apiBase || '/api/mining-checker/v1';
const initialProjectKey = root.dataset.defaultProjectKey || 'doge-main';
const initialActiveTab = String(root.dataset.activeView || 'overview').trim() || 'overview';
@@ -734,6 +734,7 @@
const [error, setError] = useState('');
const [message, setMessage] = useState('');
const [schemaStatus, setSchemaStatus] = useState(normalizeSchemaStatus(null));
const bootstrapCacheRef = useRef(new Map());
const [initForm, setInitForm] = useState({ drop_existing: false });
const [sqlImportFile, setSqlImportFile] = useState(null);
const [dbCheck, setDbCheck] = useState(null);
@@ -1160,14 +1161,21 @@
}
async function loadBootstrap(key) {
setLoading(true);
const cacheKey = `${key}:${activeTab || 'overview'}`;
const cachedPayload = bootstrapCacheRef.current.get(cacheKey) || null;
setLoading(!cachedPayload);
setError('');
setPayload((previous) => previous || normalizeBootstrap(null, key));
if (cachedPayload) {
setPayload(cachedPayload);
} else {
setPayload((previous) => previous || normalizeBootstrap(null, key));
}
let loadGuardTriggered = false;
const loadGuard = window.setTimeout(() => {
loadGuardTriggered = true;
setLoading(false);
setPayload((previous) => previous || normalizeBootstrap(null, key));
setPayload((previous) => previous || cachedPayload || normalizeBootstrap(null, key));
setError((previous) => previous || 'Bootstrap-Request haengt oder braucht zu lange.');
}, 12000);
@@ -1181,6 +1189,7 @@
const params = new URLSearchParams({ view: activeTab || 'overview' });
const data = await request(`${apiBase}/projects/${encodeURIComponent(key)}/bootstrap?${params.toString()}`, { timeoutMs: 10000 });
const normalized = normalizeBootstrap(data, key);
bootstrapCacheRef.current.set(cacheKey, normalized);
setPayload(normalized);
setSettingsForm({
baseline_measured_at: normalized.settings.baseline_measured_at || '',
@@ -1191,7 +1200,6 @@
setFxSelection(Array.isArray(normalized.settings.preferred_currencies) && normalized.settings.preferred_currencies.length
? normalized.settings.preferred_currencies
: ['DOGE', 'USD', 'EUR']);
loadFxHistory(key);
setTargetForm((previous) => ({
...previous,
currency: normalized.settings.currencies?.[0]?.code || previous.currency || 'EUR',
@@ -1215,6 +1223,13 @@
loadBootstrap(projectKey);
}, [projectKey, activeTab]);
useEffect(() => {
if (activeTab !== 'mining') {
return;
}
loadFxHistory(projectKey);
}, [activeTab, projectKey]);
useEffect(() => {
syncMiningCheckerTabButtons(activeTab);