-
-
Notifications
You must be signed in to change notification settings - Fork 4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix react microservice user relation request #11830
fix react microservice user relation request #11830
Conversation
send the entire user object (including login) instead of just the id field Fix jhipster#11792
This fails for a very simple app:
the previous code works though. Seems like there should be two implementations. edit: this doesn't work for monoliths |
It won't work for monoliths because of the user id's type: we're comparing strings and numbers :( |
generators/entity-client/templates/react/src/main/webapp/app/entities/entity-update.tsx.ejs
Outdated
Show resolved
Hide resolved
generators/entity-client/templates/react/src/main/webapp/app/entities/entity-update.tsx.ejs
Outdated
Show resolved
Hide resolved
generators/entity-client/templates/react/src/main/webapp/app/entities/entity-update.tsx.ejs
Outdated
Show resolved
Hide resolved
@MathieuAA Thanks for catching that. @mraible Your PR only changed the form when the relationship was not required, but the open issue has a required relationship. With the latest changes, combos mostly work (there are a lot of them). I used the JDL: JDL app/entity definitionsapplication { config { baseName reactJwt clientFramework react } entities * } application { config { baseName reactOauth clientFramework react authenticationType oauth2 } entities * } entity Member { firstName String lastName String } entity MemberDto { firstName String lastName String } entity MemberReq { firstName String lastName String } entity MemberDtoReq { firstName String lastName String } relationship OneToOne { Member{user(login)} to User MemberReq{user(login) required} to User MemberDto{user(login)} to User MemberDtoReq{user(login) required} to User } dto MemberDto, MemberDtoReq with mapstruct
|
CI tests were failing because they use a different relationship name than Since this is only needed for OAuth2 gateways, I added that as a condition as well. |
generators/entity-client/templates/react/src/main/webapp/app/entities/entity-update.tsx.ejs
Show resolved
Hide resolved
generators/entity-client/templates/react/src/main/webapp/app/entities/entity-update.tsx.ejs
Show resolved
Hide resolved
generators/entity-client/templates/react/src/main/webapp/app/entities/entity-update.tsx.ejs
Show resolved
Hide resolved
as there are 2 approvals, let's merge this |
Send the entire user object (including
login
) instead of just theid
fieldIn Angular, we pass the whole User object
"user": {"id": "1", "login": "system", "firstName": "System" .... }
In React we only pass the ID
"user":{"id":"1"}
, which results in an invalid User since login is a required field. This is because the value returned from the select box only returns the id.Fixed by finding the
user
inprops.
user with the matchingid
.Fix #11792
Please make sure the below checklist is followed for Pull Requests.
All continuous integration tests are green
Tests are added where necessary
Documentation is added/updated where necessary
Coding Rules & Commit Guidelines as per our CONTRIBUTING.md document are followed