-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Cannot clear Relationship field (without many set to true) #4711
Comments
I've also encountered this bug and looked a little into it. The POST request is already wrong (the data isn't erased) so this must be a frontend bug. |
One item I'd like to add: I've seen this same issue, but the POST data is correct. I don't think it's a front-end issue, but when I look at the data in a pre-save hook the association ID is still set. |
Look at the Keyvisual field, it should be empty here but it isn't. |
Here are my screenshots: webkit form data with and without the relationship set. When the field is cleared, the data is no longer present between "state" and "author" (it's not anywhere else in the POST data either). I'm not sure if it has something to do with the fact our data includes a file upload which is why the form data is in this format, but it doesn't change the fact that on the server, it still thinks the relationship with that particular document exists. |
Yeah I was wrong! I Looked at the server response instead of the actual POST request. |
Just ran into this myself. I can't clear a singular relationship field (the value is restored when I save the document). |
The problem I found was with react-select and removing the single relationship, removed the hidden field that holds the value that is collated with the rest of the form data and sent to api. Because the param for the relationship is empty, the server process ignores any change. {many: true} works because a hidden field is generated in that case, see line 225: My solution was to add:
in render beneath
on line 233 |
Expected behavior
For
Relationship
fields withoutmany
set totrue
, if I clear theSelect
input, the value should be removed.Actual/Current behavior
The value remains.
This looks like caused by keystonejs/keystone@5df6846. The
many: true
case was fixed by keystonejs/keystone#4667. How about themany: false
case?Steps to reproduce the actual/current behavior
Environment
The text was updated successfully, but these errors were encountered: