Repository navigation
feat: Create user page - #1197
Conversation
bug in formErrors story
Doesn't work in test
Codecov Report
@@ Coverage Diff @@
## main #1197 +/- ##
==========================================
+ Coverage 66.00% 66.30% +0.29%
==========================================
Files 265 268 +3
Lines 16751 16817 +66
Branches 157 162 +5
==========================================
+ Hits 11057 11151 +94
+ Misses 4533 4508 -25
+ Partials 1161 1158 -3
Continue to review full report at Codecov.
|
This reverts commit cf8442f.
|
|
||
| export const CreateUserPage: React.FC = () => { | ||
| const xServices = useContext(XServiceContext) | ||
| const myOrgId = useSelector(xServices.authXService, selectOrgId) |
There was a problem hiding this comment.
Doing this instead of getting authState using useActor means that this component will only re-render in response to changes in the org id, not all authXService changes. I haven't bothered with this approach in other places yet because so far it's been components that have a lot to do with the XService they're accessing and there probably won't be many irrelevant updates, but we should do this for cases where we only care about a little piece of some global state.
| email: "", | ||
| password: "", | ||
| username: "", | ||
| organization_id: myOrgId, |
There was a problem hiding this comment.
I just hard-coded the org id in here; in EE we'll need a drop-down field for it.
| target: "idle", | ||
| actions: ["assignCreateUserError"], | ||
| }, | ||
| ], |
There was a problem hiding this comment.
This works like a switch statement - if the cond is true on the first case, do that, otherwise try the next case.
| onError: [ | ||
| { | ||
| target: "idle", | ||
| cond: "isFormError", | ||
| actions: ["assignCreateUserFormErrors"], | ||
| }, | ||
| { | ||
| target: "idle", | ||
| actions: ["assignCreateUserError"], | ||
| }, | ||
| ], |
Co-authored-by: G r e y <grey@coder.com>
Blocked by #1184Fixes #734
I'm pretending users come with org ids in preparation for Bruno's PRselectorto get the org id out of theauthXServicewithout making theCreateUserPagere-render for every change toauthXServiceCreateUserFormstories have a flash of a validation error message. That appears to be a Storybook problem where it thinks the field istouchedmomentarily, maybe a lag from looking at a related story.navigatein an action like @BrunoQuaresma suggested. I prefer this over embedding it incontextbecause in the latter solution, the XService has to know our routes.