Describe the bug
It seems that a recent update of the relation widget lost the ability to preserve the type of the relation.
In my case, I am using a relation to an integer and for some reason double quotes are added around the value (which turn into a string on the front-end side; I'm using jekyll, and in liquid when you compare 2 to "2" you get false, which breaks my site).
To Reproduce
Let say you have a category collection with a field of type int :
- { label: 'Name', name: 'name', widget: 'number', valueType: 'int' }
and another collection with a field with a relation widget:
- {
label: 'Category',
name: "category",
widget: "relation",
collection: "categories",
displayFields: [name],
searchFields: [name],
valueField: "name"
}
Now in the front matter block I get :
category: "4"
Expected behavior
When I'm saving/updating an object I'm expecting to find
category: 4
in the front matter block.
Applicable Versions:
netlify-cms-app 2.12.12
bootstrap.js:83 netlify-cms-core 2.26.0
index.js:27 netlify-cms 2.10.48
Note:
I fixed my website simply by turning the integer fields into string fields, so the issue stopped being one for me, but I would not be surprised if some other users hit the same problem.
Thanks @mlasson, this is probably since we added string template support for the widget.
@erezrokah I'd like to work on this issue.
Most helpful comment
@erezrokah I'd like to work on this issue.