-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
I am using Netlify-CMS to build a readonly site, so I am using custom components which don't allow editing instead of the default ones.
One of those controls is a link to another-page-in-the-app control, which I'm using where one might ordinarily have a relation widget.
Describe the bug
When I follow the link to the linked page, any fields which have the same name as on the previous page are not updated.
To Reproduce
- Visit https://cuzkv.csb.app/#/collections/products/entries/Sentry
- Click the "Some Team" text in the owner section, (which is an anchor tag, linking to
https://cuzkv.csb.app/#/collections/teams/entries/Some%20Team
)
Expected behaviour
page is the same as if you have pasted the https://cuzkv.csb.app/#/collections/teams/entries/Some%20Team url into browser
Actual behaviour
The 'Name' field still says "Sentry"
Expected behavior
The 'Name' field says "Some Team"
Applicable Versions:
- Netlify CMS version: [e.g. 2.0.4]
- Git provider: repo-test
- OS: Ubunut 20.04
- Browser version chrome 83.0.4103.116 (Official Build) (64-bit)
https://codesandbox.io/s/cuzkv?file=/config.yml
Additional context
This is my custom widget. I wonder if I should be using a react router Link instead of an a
but I don't know how to do that...
CMS.registerWidget(
"relation-readonly",
createClass({
render: function () {
return this.props.value
? h(
"a",
{
id: this.props.forID,
className: this.props.classNameWrapper,
href:
"#/collections/" +
this.props.field._root.entries[0][1] +
"/entries/" +
this.props.value
},
this.props.value
)
: h("span");
}
})
);