Allow to edit and delete campaigns
Created by: felixfbecker
Adds edit and delete buttons and an "edit" state to the campaign details page. It also replaces the NewCampaignsPage
.
Interesting fact: This is the first full CRUD form component in the Sourcegraph web app that I am aware of. And it is actually not that easy to make this work properly, meaning
- type safe i.e. without casts or
!
- with proper error handling
- form validation
- proper loading state handling
- blocking history navigation
- preventing race conditions
- sharing the same JSX for edit, create and display to ensure consistent design and an inline-editing UX
I was looking for a good way to do this with hooks, and I am not happy with the result yet, but I wanted to ship this feature for this iteration (classes wouldn't have been easier either though). I'll experiment some more after this to better represent the state machine that is such a form in a type-safe way.
Ref #5678 (closed)
cc @sourcegraph/automation