You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hiya! I've been having a blast with FireCMS v3, and so far all is well. I have found one minor issue, when trying to create a reference to a document within a subcollection whose parent is defined by another property that's within a repeated group property.
Here's a basic example:
import{get}from"lodash";import{buildCollection}from"@firecms/core";constexampleCollection=buildCollection({// Yadda yadda yadda...,properties: {example: {name: "Example",dataType: "array",of: {dataType: "map",properties: {parent: {name: "Parent",dataType: "reference",path: "parents",},child: ({ propertyKey, values })=>{// propertyKey is not always defined, so we need to wrap in a conditionalif(propertyKey){// Get path relative to parent, since we're in an array// propertyKey looks something like "example.0.child", so to get the parent// we need to remove "child" and replace with "parent", and the retrieve// from the values object.constparentPropPath=propertyKey.split(".").slice(0,-1);parentPropPath.push("parent");constparent=get(values,parentPropPath);return{name: "Child",dataType: "reference",path: `${parent.pathWithId}/children`,}}else{return{name: "Child",dataType: "reference",path: "parents",disabled: {clearOnDisabled: true,disabledMessage: "Please select a parent",}}}}}}}}});
The propertyKey seems to only sometimes be populated:
Meanwhile, is there a better way to point a reference field to a document's subcollection path?
The text was updated successfully, but these errors were encountered:
Hiya! I've been having a blast with FireCMS v3, and so far all is well. I have found one minor issue, when trying to create a reference to a document within a subcollection whose parent is defined by another property that's within a repeated group property.
Here's a basic example:
The
propertyKey
seems to only sometimes be populated:Meanwhile, is there a better way to point a reference field to a document's subcollection path?
The text was updated successfully, but these errors were encountered: