fix: compliance-scope — Infinite-Render-Loop + Sticky-Footer-Overlap
All checks were successful
CI / go-lint (push) Has been skipped
CI / python-lint (push) Has been skipped
CI / nodejs-lint (push) Has been skipped
CI / test-go-ai-compliance (push) Successful in 34s
CI / test-python-backend-compliance (push) Successful in 32s
CI / test-python-document-crawler (push) Successful in 20s
CI / test-python-dsms-gateway (push) Successful in 18s

useEffect[dispatch, sdkState.complianceScope] → dispatch → sdkState-Update
→ Effect wieder auslösen → setScopeState → dispatch → ... (endlos)
Fix: Load-Effect mit [] (einmalig on mount), CSS-Kommentar für eslint.

Sticky bottom-6 Footer lag über Wizard-Navigationsbuttons ohne padding-Puffer.
Fix: tab content pb-28 damit Zurück/Weiter/Auswertung-starten erreichbar bleiben.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Benjamin Admin
2026-03-03 22:35:11 +01:00
parent 7a55955439
commit 29e6998a28

View File

@@ -49,21 +49,21 @@ export default function ComplianceScopePage() {
const [isLoading, setIsLoading] = useState(true)
const [isEvaluating, setIsEvaluating] = useState(false)
// Load from SDK context first (persisted via State API), then localStorage as fallback
// Load from SDK context first (persisted via State API), then localStorage as fallback.
// Runs ONCE on mount only — empty deps breaks the dispatch→sdkState→setScopeState→dispatch loop.
useEffect(() => {
try {
// Priority 1: SDK context (loaded from PostgreSQL via State API)
if (sdkState.complianceScope && sdkState.complianceScope.answers?.length > 0) {
setScopeState(sdkState.complianceScope)
// Also update localStorage for offline fallback
localStorage.setItem(STORAGE_KEY, JSON.stringify(sdkState.complianceScope))
const ctxScope = sdkState.complianceScope
if (ctxScope && ctxScope.answers?.length > 0) {
setScopeState(ctxScope)
localStorage.setItem(STORAGE_KEY, JSON.stringify(ctxScope))
} else {
// Priority 2: localStorage fallback
const stored = localStorage.getItem(STORAGE_KEY)
if (stored) {
const parsed = JSON.parse(stored) as ComplianceScopeState
setScopeState(parsed)
// Sync to SDK context for backend persistence
dispatch({ type: 'SET_COMPLIANCE_SCOPE', payload: parsed })
}
}
@@ -72,7 +72,8 @@ export default function ComplianceScopePage() {
} finally {
setIsLoading(false)
}
}, [dispatch, sdkState.complianceScope])
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])
// Save to localStorage and SDK context whenever state changes
useEffect(() => {
@@ -248,8 +249,8 @@ export default function ComplianceScopePage() {
</nav>
</div>
{/* Tab Content */}
<div className="p-6">
{/* Tab Content — pb-28 verhindert dass sticky Footer die unteren Buttons verdeckt */}
<div className="p-6 pb-28">
{activeTab === 'overview' && (
<ScopeOverviewTab
scopeState={scopeState}