Description
src/features/admin/pages/AdminPage.tsx renders exactly one error banner on the page, positioned inside the Ecosystems section, right below the "Add New Ecosystem" button:
{/* Inline error (avoid ugly alerts) */}
{errorMessage && (
<div className={`mb-4 rounded-[16px] border px-4 py-3 text-[13px] ...`}>
{errorMessage}
</div>
)}
errorMessage (and setErrorMessage) is a single piece of state declared once near the top of the component. It is correctly used by the ecosystems create/edit/delete handlers, but it is also reused by the completely unrelated Open-Source Week event handlers:
const handleDeleteOswConfirmed = async () => {
...
} catch (e) {
setErrorMessage(e instanceof Error ? e.message : 'Failed to delete event.')
} finally {
setOswDeletingId(null)
}
}
const handleCreateOsw = async (e: React.FormEvent) => {
...
try {
setErrorMessage(null)
...
await createOpenSourceWeekEvent({ ... })
...
} catch (err) {
setErrorMessage(err instanceof Error ? err.message : 'Failed to create event.')
} finally {
setIsSubmitting(false)
}
}
The "Add Open-Source Week Event" modal (showAddOswModal, rendered far below in the JSX) has no error display of its own — only per-field validation errors (oswErrors). So when createOpenSourceWeekEvent fails while that modal is open, the resulting error is written into errorMessage and rendered in the Ecosystems section's banner, which sits behind/above the still-open modal and is not visible to the admin filling out the form. The admin sees the modal just stop submitting with no visible explanation, while an unrelated error banner silently appears in a different section of the page they can't currently see. The same happens for OSW event deletion failures.
Requirements
- Give the Open-Source Week section (including its create/delete flows) its own error state, independent from the Ecosystems section's
errorMessage.
- Surface OSW create/delete errors inside (or immediately adjacent to) the relevant modal/section so they're visible at the moment they occur.
Suggested execution
- Fork the repo and create a branch:
git checkout -b fix/adminpage-osw-error-state-isolation
- Add a dedicated
oswErrorMessage/setOswErrorMessage state, separate from the ecosystems' errorMessage.
- Update
handleCreateOsw and handleDeleteOswConfirmed to use the new state instead of errorMessage.
- Render the OSW error inline inside the "Add Open-Source Week Event" modal (for create failures) and near the OSW events list (for delete failures).
- Add a test asserting a failed OSW event creation surfaces an error inside the open modal, not in the ecosystems section.
Example commit message
fix: isolate Open-Source Week error state from the ecosystems errorMessage
Acceptance criteria
Security notes
None; this is a UX-correctness issue — an admin could otherwise repeatedly retry a failing action believing nothing happened, with no compounding security effect.
Guidelines
- Minimum 95% test coverage
- Timeframe: 96 hours
Description
src/features/admin/pages/AdminPage.tsxrenders exactly one error banner on the page, positioned inside the Ecosystems section, right below the "Add New Ecosystem" button:errorMessage(andsetErrorMessage) is a single piece of state declared once near the top of the component. It is correctly used by the ecosystems create/edit/delete handlers, but it is also reused by the completely unrelated Open-Source Week event handlers:The "Add Open-Source Week Event" modal (
showAddOswModal, rendered far below in the JSX) has no error display of its own — only per-field validation errors (oswErrors). So whencreateOpenSourceWeekEventfails while that modal is open, the resulting error is written intoerrorMessageand rendered in the Ecosystems section's banner, which sits behind/above the still-open modal and is not visible to the admin filling out the form. The admin sees the modal just stop submitting with no visible explanation, while an unrelated error banner silently appears in a different section of the page they can't currently see. The same happens for OSW event deletion failures.Requirements
errorMessage.Suggested execution
git checkout -b fix/adminpage-osw-error-state-isolationoswErrorMessage/setOswErrorMessagestate, separate from the ecosystems'errorMessage.handleCreateOswandhandleDeleteOswConfirmedto use the new state instead oferrorMessage.Example commit message
Acceptance criteria
errorMessage.Security notes
None; this is a UX-correctness issue — an admin could otherwise repeatedly retry a failing action believing nothing happened, with no compounding security effect.
Guidelines