Bug: Editor fields not updating when linking between pages inside CMS
- Dominant language
- JavaScript
- Stars
- 19.4k
- Forks
- 3.1k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 9
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");
}
})
);
```
Contributor guide
Research direction
Reproduce the navigation from the product entry to the linked team entry at the provided CodeSandbox or CMS URL, then inspect the custom `relation-readonly` widget and the editor navigation path. Compare this link transition with loading the team URL directly; done means the linked entry opens with its own fields, including “Name: Some Team,” rather than retaining “Sentry”.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100