Skip to content

Bug: Editor fields not updating when linking between pages inside CMS #4147

@mcintyre321

Description

@mcintyre321

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

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");
          }
        })
      );

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions