@salesforce/lwc-adapters-uiapi 1.287.0-dev13 → 1.287.0-dev15

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.
Files changed (2) hide show
  1. package/dist/main.js +36 -11
  2. package/package.json +3 -3
package/dist/main.js CHANGED
@@ -19700,6 +19700,7 @@ function getNameField(objectInfo, fieldApiName) {
19700
19700
  }
19701
19701
  function getQualifiedFieldApiNamesFromLayout(layout, objectInfo) {
19702
19702
  const qualifiedFieldNames = [];
19703
+ const qualifiedOptionalFieldNames = [];
19703
19704
  for (let a = 0, alen = layout.sections.length; a < alen; a++) {
19704
19705
  const section = layout.sections[a];
19705
19706
  for (let b = 0, blen = section.layoutRows.length; b < blen; b++) {
@@ -19715,7 +19716,8 @@ function getQualifiedFieldApiNamesFromLayout(layout, objectInfo) {
19715
19716
  // By default, include the "Id" field on spanning records that are on the layout.
19716
19717
  qualifiedFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${FIELD_ID}`);
19717
19718
  const nameField = getNameField(objectInfo, apiName);
19718
- qualifiedFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
19719
+ // W-15692973: Name field of referenced entites are moved to optionalFields since the Name field may not exist for few entites.
19720
+ qualifiedOptionalFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
19719
19721
  }
19720
19722
  qualifiedFieldNames.push(`${objectInfo.apiName}.${component.apiName}`);
19721
19723
  }
@@ -19723,7 +19725,10 @@ function getQualifiedFieldApiNamesFromLayout(layout, objectInfo) {
19723
19725
  }
19724
19726
  }
19725
19727
  }
19726
- return qualifiedFieldNames;
19728
+ return {
19729
+ fields: qualifiedFieldNames,
19730
+ optionalFields: qualifiedOptionalFieldNames,
19731
+ };
19727
19732
  }
19728
19733
 
19729
19734
  function getMissingRecordLookupFields(record, objectInfo) {
@@ -20144,11 +20149,13 @@ function refresh$1(luvio, config) {
20144
20149
  throw new Error(`RecordUi adapter resolved with a ${snapshot.state} snapshot with undefined data`);
20145
20150
  }
20146
20151
  const { layoutMap, objectInfo } = getLayoutMapAndObjectInfo(recordId, data);
20147
- const fields = getFieldsFromLayoutMap(layoutMap, objectInfo);
20152
+ // W-15692973: Name field of referenced entites are moved to optionalFields since the Name field may not exist for few entites.
20153
+ const { fields, optionalFields: layoutOptionalFields } = getFieldsFromLayoutMap(layoutMap, objectInfo);
20154
+ const mergedOptionalFields = dedupe(optionalFields.concat(layoutOptionalFields));
20148
20155
  return buildCachedSnapshot$9(luvio, {
20149
20156
  recordId,
20150
20157
  fields,
20151
- optionalFields,
20158
+ optionalFields: mergedOptionalFields,
20152
20159
  }, refresh);
20153
20160
  });
20154
20161
  }
@@ -20209,6 +20216,7 @@ const recordLayoutFragmentSelector = [
20209
20216
  ];
20210
20217
  function getFieldsFromLayoutMap(layoutMap, objectInfo) {
20211
20218
  let fields = [];
20219
+ let optionalFields = [];
20212
20220
  const layoutTypes = keys(layoutMap);
20213
20221
  for (let i = 0, layoutTypesLen = layoutTypes.length; i < layoutTypesLen; i += 1) {
20214
20222
  const layoutType = layoutTypes[i];
@@ -20216,11 +20224,15 @@ function getFieldsFromLayoutMap(layoutMap, objectInfo) {
20216
20224
  const modes = keys(modesMap);
20217
20225
  for (let m = 0, modesLen = modes.length; m < modesLen; m += 1) {
20218
20226
  const mode = modes[m];
20219
- const modeKeys = getQualifiedFieldApiNamesFromLayout(modesMap[mode], objectInfo);
20220
- fields = fields.concat(modeKeys);
20227
+ const { fields: modeFields, optionalFields: modeOptionalFields } = getQualifiedFieldApiNamesFromLayout(modesMap[mode], objectInfo);
20228
+ fields = fields.concat(modeFields);
20229
+ optionalFields = optionalFields.concat(modeOptionalFields);
20221
20230
  }
20222
20231
  }
20223
- return dedupe(fields).sort();
20232
+ return {
20233
+ fields: dedupe(fields).sort(),
20234
+ optionalFields: dedupe(optionalFields).sort(),
20235
+ };
20224
20236
  }
20225
20237
  /**
20226
20238
  * W-14696113
@@ -20237,8 +20249,12 @@ function convertToImplicitFields(fields, optionalFields) {
20237
20249
  return implicitFields;
20238
20250
  }
20239
20251
  function getRecordForLayoutableEntities(luvio, refresh, recordId, layoutMap, objectInfo, configOptionalFields) {
20240
- const fields = getFieldsFromLayoutMap(layoutMap, objectInfo);
20241
- const implicitFields = convertToImplicitFields(fields, configOptionalFields);
20252
+ // W-15692973: Name field of referenced entites are moved to optionalFields since the Name field may not exist for few entites.
20253
+ let { fields, optionalFields } = getFieldsFromLayoutMap(layoutMap, objectInfo);
20254
+ if (configOptionalFields && configOptionalFields.length > 0) {
20255
+ optionalFields = dedupe(optionalFields.concat(configOptionalFields));
20256
+ }
20257
+ const implicitFields = convertToImplicitFields(fields, optionalFields);
20242
20258
  return getRecord$1(luvio, refresh, recordId, [], implicitFields);
20243
20259
  }
20244
20260
  function getRecordForNonLayoutableEntities(luvio, adapterContext, refresh, recordId, objectInfo, configOptionalFields, configFields) {
@@ -20500,8 +20516,15 @@ function buildRecordLayoutSnapshot(recordLayout, luvio, config, recordLayoutSnap
20500
20516
  return;
20501
20517
  }
20502
20518
  // transform the layouts & object info into a set of fields
20503
- const fields = getFieldsFromLayoutMap(layoutMap, objectInfoSnapshot.data);
20504
- return getRecordRepSnapshot(luvio, config, recordLayoutSnapshot, objectInfoSnapshot, fields, isRecordLayoutStale, context, storeLookup);
20519
+ // // W-15692973: Name field of referenced entites are moved to optionalFields since the Name field may not exist for few entites.
20520
+ const { fields, optionalFields } = getFieldsFromLayoutMap(layoutMap, objectInfoSnapshot.data);
20521
+ let configWithModifiedOptionalFields = {
20522
+ ...config,
20523
+ optionalFields: config.optionalFields
20524
+ ? dedupe(config.optionalFields.concat(optionalFields)).sort()
20525
+ : optionalFields,
20526
+ };
20527
+ return getRecordRepSnapshot(luvio, configWithModifiedOptionalFields, recordLayoutSnapshot, objectInfoSnapshot, fields, isRecordLayoutStale, context, storeLookup);
20505
20528
  };
20506
20529
  }
20507
20530
  function buildRecordSnapshot(luvio, config, recordLayoutSnapshot, objectInfoSnapshot, fields) {
@@ -20530,6 +20553,8 @@ function getRecordRepSnapshot(luvio, config, recordLayoutSnapshot, objectInfoSna
20530
20553
  // allow buildNetworkSnapshot() to use GetRecordFields if we were just missing some fields in L1
20531
20554
  else if (isUnfulfilledSnapshot(recordRepSnapshot)) {
20532
20555
  context.fields = fields;
20556
+ // W-15692973: Update optionalFields of config as the optional fields may have Name fields of referenced entities
20557
+ context.config.optionalFields = optionalFields;
20533
20558
  }
20534
20559
  // return however much of the record we were able to find in L1; cache policy decides if we
20535
20560
  // should consult L2 or go to network
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lwc-adapters-uiapi",
3
- "version": "1.287.0-dev13",
3
+ "version": "1.287.0-dev15",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "UIAPI adapters with LWC bindings",
6
6
  "module": "dist/main.js",
@@ -31,10 +31,10 @@
31
31
  "clean": "rm -rf dist src/generated"
32
32
  },
33
33
  "devDependencies": {
34
- "@salesforce/lds-adapters-uiapi": "^1.287.0-dev13"
34
+ "@salesforce/lds-adapters-uiapi": "^1.287.0-dev15"
35
35
  },
36
36
  "dependencies": {
37
37
  "@luvio/lwc-luvio": "0.154.17-dev2",
38
- "@salesforce/lds-default-luvio": "^1.287.0-dev13"
38
+ "@salesforce/lds-default-luvio": "^1.287.0-dev15"
39
39
  }
40
40
  }