Description
src/features/admin/pages/AdminPage.tsx defines two very similar list-loading functions right next to each other. fetchEcosystems correctly surfaces failures to the admin:
const fetchEcosystems = async () => {
try {
setIsLoading(true)
setErrorMessage(null)
const response = await getAdminEcosystems()
setEcosystems(response.ecosystems || [])
setEcosystemsVisibleCount(clampLimit(ECOSYSTEMS_PAGE_SIZE))
} catch (error) {
logger.error('Failed to fetch ecosystems:', error)
setEcosystems([])
setErrorMessage(error instanceof Error ? error.message : 'Failed to load ecosystems.')
} finally {
setIsLoading(false)
}
}
but fetchOswEvents, called from the same useEffect on mount, does not:
const fetchOswEvents = async () => {
try {
setIsOswLoading(true)
const res = await getAdminOpenSourceWeekEvents()
setOswEvents(res.events || [])
setOswVisibleCount(clampLimit(OSW_EVENTS_PAGE_SIZE))
} catch (e) {
setOswEvents([])
} finally {
setIsOswLoading(false)
}
}
If getAdminOpenSourceWeekEvents() fails (network error, 500, auth expiry, etc.), the catch block silently resets oswEvents to an empty array with no logging and no errorMessage/toast — an admin sees an indistinguishable "no events" empty state instead of being told the request failed, and has no way to tell a real "zero events configured" state apart from "the fetch broke."
Requirements
fetchOswEvents's catch block must log the error (matching fetchEcosystems's logger.error call) and surface a user-visible error state for the Open-Source Week events section.
- The error state must be distinguishable from a genuine empty list (see the related issue about
handleCreateOsw/handleDeleteOswConfirmed reusing the wrong errorMessage state — this should use a dedicated OSW-scoped error state rather than reusing the ecosystems' errorMessage).
Suggested execution
- Fork the repo and create a branch:
git checkout -b fix/adminpage-osw-events-fetch-error-handling
- Add an
oswErrorMessage state (mirroring errorMessage) and set it in fetchOswEvents's catch block, alongside a logger.error call.
- Render the OSW error state near the Open-Source Week events section, matching the ecosystems section's existing error banner pattern.
- Add a test asserting a rejected
getAdminOpenSourceWeekEvents() call surfaces a visible error rather than a silent empty list.
Example commit message
fix: surface fetchOswEvents failures instead of silently swallowing them
Acceptance criteria
Security notes
None directly, but silently hiding fetch failures can mask backend/auth problems from admins, which is worth flagging in review.
Guidelines
- Minimum 95% test coverage
- Timeframe: 96 hours
Description
src/features/admin/pages/AdminPage.tsxdefines two very similar list-loading functions right next to each other.fetchEcosystemscorrectly surfaces failures to the admin:but
fetchOswEvents, called from the sameuseEffecton mount, does not:If
getAdminOpenSourceWeekEvents()fails (network error, 500, auth expiry, etc.), the catch block silently resetsoswEventsto an empty array with no logging and noerrorMessage/toast — an admin sees an indistinguishable "no events" empty state instead of being told the request failed, and has no way to tell a real "zero events configured" state apart from "the fetch broke."Requirements
fetchOswEvents's catch block must log the error (matchingfetchEcosystems'slogger.errorcall) and surface a user-visible error state for the Open-Source Week events section.handleCreateOsw/handleDeleteOswConfirmedreusing the wrongerrorMessagestate — this should use a dedicated OSW-scoped error state rather than reusing the ecosystems'errorMessage).Suggested execution
git checkout -b fix/adminpage-osw-events-fetch-error-handlingoswErrorMessagestate (mirroringerrorMessage) and set it infetchOswEvents's catch block, alongside alogger.errorcall.getAdminOpenSourceWeekEvents()call surfaces a visible error rather than a silent empty list.Example commit message
Acceptance criteria
Security notes
None directly, but silently hiding fetch failures can mask backend/auth problems from admins, which is worth flagging in review.
Guidelines