feat(docs): add performance baseline documentation and update architecture references
Deploy Development / deploy (push) Successful in 41s
Test Suite / pytest-backend (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 11s
Test Suite / playwright-tests (push) Successful in 57s

- Introduced a new section for the Performance-Baseline in CLAUDE.md and updated HANDOVER.md to include references to the new BASELINE_SNAPSHOT.md.
- Enhanced architecture documentation in README.md to clarify the purpose of the baseline snapshot and its relevance to the refactor roadmap.
- Refactored OrgInboxContext to implement a unified loading logic for join requests and content reports, improving code maintainability and performance.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
LarsandClaude Sonnet 4.6 committed 2026-05-14 06:53:37 +02:00
1 parent 255fa45e90
commit 4b2848c7c3
9 files changed
+221 -54

No files matched your search

+34 -42
View File
@@ -27,6 +27,29 @@ export function notifyOrgInboxChanged() {
window.dispatchEvent(new Event('shinkan:inbox-changed'))
}
/** Eine konsistente Ladepfad-Logik für Join-Requests + Content-Reports (ein Codepfad für Mount + refresh). */
async function fetchOrgInboxSnapshot(canAccess, canAccessReports) {
const out = { items: [], contentReports: [], contentReportsError: null }
if (canAccess) {
try {
const data = await api.getInboxJoinRequests()
out.items = Array.isArray(data) ? data : []
} catch {
out.items = []
}
}
if (canAccessReports) {
try {
const data = await api.getInboxContentReports()
out.contentReports = Array.isArray(data) ? data : []
} catch (err) {
out.contentReports = []
out.contentReportsError = err?.message || String(err)
}
}
return out
}
export function OrgInboxProvider({ user, children }) {
const [items, setItems] = useState([])
const [contentReports, setContentReports] = useState([])
@@ -35,30 +58,16 @@ export function OrgInboxProvider({ user, children }) {
const canAccessReports = useMemo(() => canSeeContentReports(user), [user])
const refresh = useCallback(async () => {
if (!canAccess) {
if (!canAccess && !canAccessReports) {
setItems([])
} else {
try {
const data = await api.getInboxJoinRequests()
setItems(Array.isArray(data) ? data : [])
} catch {
setItems([])
}
}
if (!canAccessReports) {
setContentReports([])
setContentReportsError(null)
} else {
try {
const data = await api.getInboxContentReports()
setContentReports(Array.isArray(data) ? data : [])
setContentReportsError(null)
} catch (err) {
setContentReports([])
setContentReportsError(err?.message || String(err))
}
return
}
const snap = await fetchOrgInboxSnapshot(canAccess, canAccessReports)
setItems(snap.items)
setContentReports(snap.contentReports)
setContentReportsError(canAccessReports ? snap.contentReportsError : null)
}, [canAccess, canAccessReports])
useEffect(() => {
@@ -70,28 +79,11 @@ export function OrgInboxProvider({ user, children }) {
}
let cancelled = false
;(async () => {
if (canAccess) {
try {
const data = await api.getInboxJoinRequests()
if (!cancelled) setItems(Array.isArray(data) ? data : [])
} catch {
if (!cancelled) setItems([])
}
}
if (canAccessReports) {
try {
const data = await api.getInboxContentReports()
if (!cancelled) {
setContentReports(Array.isArray(data) ? data : [])
setContentReportsError(null)
}
} catch (err) {
if (!cancelled) {
setContentReports([])
setContentReportsError(err?.message || String(err))
}
}
}
const snap = await fetchOrgInboxSnapshot(canAccess, canAccessReports)
if (cancelled) return
setItems(snap.items)
setContentReports(snap.contentReports)
setContentReportsError(canAccessReports ? snap.contentReportsError : null)
})()
return () => {
cancelled = true