@salesforce/lwc-adapters-uiapi 1.113.0 → 1.114.0

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 +11 -6
  2. package/package.json +3 -3
package/dist/main.js CHANGED
@@ -14508,14 +14508,15 @@ function buildDefaultsKey(listRef) {
14508
14508
  * @param config getListUi config
14509
14509
  * @param serverResponse ListUiRepresentation from the server
14510
14510
  */
14511
- function addServerDefaults(config, serverResponse, context) {
14512
- const { records: { sortBy }, info: { listReference }, } = serverResponse;
14513
- if (config.sortBy !== undefined || sortBy === null) {
14511
+ function addServerDefaults(config, records, listReference, context) {
14512
+ // If the request already contains the potential default information,
14513
+ // or the response does not come back with a default
14514
+ if (config.sortBy !== undefined || records.sortBy === null) {
14514
14515
  return;
14515
14516
  }
14516
14517
  const key = buildDefaultsKey(listReference);
14517
14518
  const currentDefaults = context.get(key) || {};
14518
- context.set(key, { ...currentDefaults, sortBy });
14519
+ context.set(key, { ...currentDefaults, sortBy: records.sortBy });
14519
14520
  }
14520
14521
  /**
14521
14522
  * Returns default values observed on previous requests for a list.
@@ -14665,11 +14666,14 @@ function keyBuilder$2w(luvio, params) {
14665
14666
  // Fetch listReference from internal store to better ensure a cache hit regardless of listViewApiName or listViewId
14666
14667
  const listReference = getListReference(query, context$1);
14667
14668
  if (listReference !== undefined) {
14669
+ // Check and use any default values returned from the server (i.e. sortBy)
14670
+ const config = { ...params.urlParams, ...params.queryParams };
14671
+ const defaults = getServerDefaults(config, context$1);
14668
14672
  return keyBuilder$2C(luvio, {
14669
14673
  objectApiName: listReference.objectApiName,
14670
14674
  listViewApiName: listReference.listViewApiName,
14671
14675
  listViewId: listReference.id,
14672
- sortBy: params.queryParams.sortBy || [],
14676
+ sortBy: params.queryParams.sortBy || defaults.sortBy || [],
14673
14677
  });
14674
14678
  }
14675
14679
  // If there are no matching entries in the store, then we haven't fetched any data for this list view yet.
@@ -16295,7 +16299,7 @@ function onResourceSuccess_getListUi(luvio, context, config, response) {
16295
16299
  // remember the id/name of this list
16296
16300
  addListReference(listReference, context);
16297
16301
  // remember any default values that the server filled in
16298
- addServerDefaults(config, body, context);
16302
+ addServerDefaults(config, body.records, listReference, context);
16299
16303
  // build the selector while the list info is still easily accessible
16300
16304
  const fragment = buildListUiFragment(config, context, fields);
16301
16305
  luvio.storeIngest(listUiKey, ingest$1p, body);
@@ -55696,6 +55700,7 @@ function onFetchResponseSuccess$1(luvio, config, resourceParams, response) {
55696
55700
  // Note: The original listReference will remain unchanged in the response.
55697
55701
  mutatedListRef.id = body.listInfoETag;
55698
55702
  addListReferenceWithId(mutatedListRef, context, body.listReference.id);
55703
+ addServerDefaults(config, body, originalListRef, context);
55699
55704
  }
55700
55705
  return onFetchResponseSuccess$2(luvio, config, resourceParams, response);
55701
55706
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/lwc-adapters-uiapi",
3
- "version": "1.113.0",
3
+ "version": "1.114.0",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "description": "UIAPI adapters with LWC bindings",
6
6
  "module": "dist/main.js",
@@ -32,10 +32,10 @@
32
32
  },
33
33
  "devDependencies": {
34
34
  "@luvio/engine": "0.137.1",
35
- "@salesforce/lds-adapters-uiapi": "^1.113.0"
35
+ "@salesforce/lds-adapters-uiapi": "^1.114.0"
36
36
  },
37
37
  "dependencies": {
38
38
  "@luvio/lwc-luvio": "0.137.1",
39
- "@salesforce/lds-default-luvio": "^1.113.0"
39
+ "@salesforce/lds-default-luvio": "^1.114.0"
40
40
  }
41
41
  }