@contentful/experiences-visual-editor-react 3.8.0-beta.1 → 3.8.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1530,6 +1530,9 @@ const getPrebindingPathBySourceEntry = (preboundValueProperty, getHeadEntityByDa
1530
1530
  return undefined;
1531
1531
  }
1532
1532
  const contentTypeId = headEntity.sys.contentType.sys.id;
1533
+ if (!preboundValueProperty.pathsByContentType?.[contentTypeId]) {
1534
+ return undefined;
1535
+ }
1533
1536
  return preboundValueProperty.pathsByContentType?.[contentTypeId]?.path;
1534
1537
  };
1535
1538
  const parseDeepPath$1 = (deepPathCandidate) => {
@@ -5103,14 +5106,28 @@ const useComponentProps = ({ node, entityStore, areEntitiesFetched, resolveDesig
5103
5106
  // eg: "/uuid" vs "/uuid/fields/[fileName]/~locale" as the regular BoundValue would have
5104
5107
  const [, uuid, maybePath] = variableMapping.path.split('/');
5105
5108
  const link = dataSource[uuid];
5106
- let boundValue;
5107
5109
  // starting from here, if the prop is of type 'BoundValue', and has prebinding
5108
5110
  // we are going to resolve the incomplete path
5111
+ let boundValue;
5112
+ // TODO: Temporary fix while we look into SPA-3212 it occurs where we have prebound props but data source link is missing
5113
+ // this only occurs after live updates of nested patterns.
5114
+ if (!link && isPreboundProp(variableMapping) && variableMapping.isPrebound) {
5115
+ return {
5116
+ ...acc,
5117
+ [variableName]: variableDefinition.defaultValue,
5118
+ };
5119
+ }
5109
5120
  if (link && isPreboundProp(variableMapping) && variableMapping.isPrebound) {
5110
5121
  const prebindingPath = getPrebindingPathBySourceEntry(variableMapping, (dataSourceKey) => {
5111
5122
  const link = dataSource[dataSourceKey];
5112
5123
  return entityStore.getEntityFromLink(link);
5113
- }) ?? variableMapping.path;
5124
+ });
5125
+ if (!prebindingPath) {
5126
+ return {
5127
+ ...acc,
5128
+ [variableName]: variableDefinition.defaultValue,
5129
+ };
5130
+ }
5114
5131
  // this allows us to resolve it regularly
5115
5132
  boundValue = transformBoundContentValue(node.data.props, entityStore, link, resolveDesignValue, variableName, variableDefinition.type, prebindingPath);
5116
5133
  }