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