@salesforce/lwc-adapters-uiapi 1.434.0 → 1.435.1

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 +17 -13
  2. package/package.json +3 -3
package/dist/main.js CHANGED
@@ -18506,17 +18506,15 @@ function getRelationshipName(objectInfo, fieldApiName) {
18506
18506
  return objectInfo.fields[fieldApiName].relationshipName;
18507
18507
  }
18508
18508
  function getNameField(objectInfo, fieldApiName) {
18509
- // eslint-disable-next-line @salesforce/lds/no-invalid-todo
18510
- // TODO - this logic is adopted from lds222. It searches
18511
- // ObjectInfoRep.ReferenceToInfoRep[].nameFields[]:
18512
- // 1. If any of the arrays are empty returns `Name`
18513
- // 2. If `Name` is found in any array position then returns it
18514
- // 3. If the field has more than 1 references(polymorphic), return `Name`
18515
- // 4. Else returns ObjectInfoRep.ReferenceToInfoRep[0].nameFields[0]
18516
- // Rationale for this is unclear and needs clarification.
18517
18509
  const referenceToInfos = objectInfo.fields[fieldApiName].referenceToInfos;
18518
18510
  if (referenceToInfos.length !== 1) {
18519
- return FIELD_NAME;
18511
+ // For polymorphic fields, return "Name" only if at least one referenced entity has it.
18512
+ // If no entity in the domain set has a Name field (e.g. ContextTag uses "Title"),
18513
+ // sending "Name" to getRecordWithFields causes INVALID_FIELD at the DB layer (W-22253765).
18514
+ // We stay permissive for mixed cases (some have Name, some don't) — those are handled
18515
+ // server-side once W-22253765's companion fix lands in QueryValidatorImpl.
18516
+ const anyHaveName = referenceToInfos.some((ref) => ref.nameFields.includes(FIELD_NAME));
18517
+ return anyHaveName ? FIELD_NAME : undefined;
18520
18518
  }
18521
18519
  const firstReferenceNameFields = referenceToInfos[0].nameFields;
18522
18520
  if (firstReferenceNameFields.length < 1) {
@@ -18551,8 +18549,11 @@ function getQualifiedFieldApiNamesFromLayout(layout, objectInfo) {
18551
18549
  // By default, include the "Id" field on spanning records that are on the layout.
18552
18550
  qualifiedFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${FIELD_ID}`);
18553
18551
  const nameField = getNameField(objectInfo, apiName);
18554
- // W-15692973: Name field of referenced entites are moved to optionalFields since the Name field may not exist for few entites.
18555
- qualifiedOptionalFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
18552
+ // W-15692973: Name field of referenced entities are moved to optionalFields since the Name field may not exist for few entities.
18553
+ // W-22253765: For polymorphic FKs where not all entities have "Name", nameField is undefined — skip the optional field entirely.
18554
+ if (nameField !== undefined) {
18555
+ qualifiedOptionalFieldNames.push(`${objectInfo.apiName}.${relationshipFieldApiName}.${nameField}`);
18556
+ }
18556
18557
  }
18557
18558
  qualifiedFieldNames.push(`${objectInfo.apiName}.${component.apiName}`);
18558
18559
  }
@@ -18586,8 +18587,11 @@ function getMissingRecordLookupFields(record, objectInfo) {
18586
18587
  // Include the Id field. Ex: Opportunity.Account.Id, Opportunity.relation1__r.Id
18587
18588
  const idFieldName = `${apiName}.${relationshipName}.Id`;
18588
18589
  lookupFields[idFieldName] = true;
18589
- const nameField = `${apiName}.${relationshipName}.${getNameField(objectInfo, fieldName)}`;
18590
- lookupFields[nameField] = true;
18590
+ const resolvedNameField = getNameField(objectInfo, fieldName);
18591
+ // W-22253765: skip the name field for polymorphic FKs where not all entities have "Name"
18592
+ if (resolvedNameField !== undefined) {
18593
+ lookupFields[`${apiName}.${relationshipName}.${resolvedNameField}`] = true;
18594
+ }
18591
18595
  }
18592
18596
  return keys(lookupFields);
18593
18597
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lwc-adapters-uiapi",
3
- "version": "1.434.0",
3
+ "version": "1.435.1",
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.434.0"
34
+ "@salesforce/lds-adapters-uiapi": "^1.435.1"
35
35
  },
36
36
  "dependencies": {
37
37
  "@luvio/lwc-luvio": "0.160.4",
38
- "@salesforce/lds-default-luvio": "^1.434.0"
38
+ "@salesforce/lds-default-luvio": "^1.435.1"
39
39
  }
40
40
  }