lumeland/cms

ResolvedField.data is undefined

Closed this issue · 4 comments

Trying to follow the field example of populating a list field with all tags present on the page yields with Lume CMS breaking, resulting in a "Not found" error.

I copied the example from the Fields documentation exactly.

I console.log'd the init method of the field and field.data is undefined, so the Lume data isn't available either.

To aid with issue reproduction, I created a cms branch in my website repository with my configuration: https://github.com/pixeldesu/pixelde.su/tree/cms

Sorry for the trouble, it's a double bug:

  • The documentation is not correct
  • The implementation is failing

I'm working on this.

Fixed in v0.7.0.

The data object is passed as the second argument. For example:

{
    name: "tags",
    type: "list",
    init(field: any, { data }) {
      const site = data.site;
      const allTags = site.search.values("tags");
      field.options = allTags;
    }
}

Thank you for the fix! 🙏 I also noticed that I wasn't on latest Lume (I was on 2.1.0, not anywhere near 2.3.3) and that was the issue why the Lume data was not accessible in CMS.

Even the fix with v0.7.0 is not working for me. When I add the above init and reload the cms, the list of pages is presented, but when I click any of them, I get "page not found" and the editor won't show. FYI.