diff --git a/expression-components/main/ui/components/base/lwc/expressionElementContainer/expressionElementContainer.js b/expression-components/main/ui/components/base/lwc/expressionElementContainer/expressionElementContainer.js
index 1a0be363..43a6bd78 100644
--- a/expression-components/main/ui/components/base/lwc/expressionElementContainer/expressionElementContainer.js
+++ b/expression-components/main/ui/components/base/lwc/expressionElementContainer/expressionElementContainer.js
@@ -4,4 +4,8 @@ export default class ExpressionElementContainer extends LightningElement {
@api cannotShowPreview = false;
@api error = null;
@api loading = false;
+
+ get showLoading() {
+ return this.loading && !this.cannotShowPreview;
+ }
}
diff --git a/expression-components/main/ui/components/base/lwc/expressionSiteElement/expressionSiteElement.js b/expression-components/main/ui/components/base/lwc/expressionSiteElement/expressionSiteElement.js
index 065b851e..1c0924d5 100644
--- a/expression-components/main/ui/components/base/lwc/expressionSiteElement/expressionSiteElement.js
+++ b/expression-components/main/ui/components/base/lwc/expressionSiteElement/expressionSiteElement.js
@@ -1,7 +1,8 @@
import TwElement from "c/twElement";
+import {refreshApex} from '@salesforce/apex';
import evaluate from '@salesforce/apex/FormulaEvaluatorUiController.evaluate';
-import { CurrentPageReference } from "lightning/navigation";
-import { wire } from "lwc";
+import {CurrentPageReference} from "lightning/navigation";
+import {wire} from "lwc";
export default class ExpressionSiteElement extends TwElement {
// These 4 need to be set by the extending class as `@api` properties.
@@ -14,6 +15,15 @@ export default class ExpressionSiteElement extends TwElement {
computed;
error;
contextId = null
+ evaluatedWire;
+
+ connectedCallback() {
+ window.addEventListener('expression_refresh', this.refreshHandler);
+ }
+
+ disconnectedCallback() {
+ window.removeEventListener('expression_refresh', this.refreshHandler);
+ }
@wire(CurrentPageReference)
setCurrentPageReference(currentPageReference) {
@@ -24,7 +34,9 @@ export default class ExpressionSiteElement extends TwElement {
}
@wire(evaluate, {recordId: '$contextId', formula: '$expr', respectSharing: '$respectSharing'})
- evaluate({error, data}) {
+ evaluate(evaluatedWire) {
+ this.evaluatedWire = evaluatedWire;
+ const {error, data} = evaluatedWire;
if (error) {
console.error(error);
this.error = error.body.message;
@@ -34,6 +46,10 @@ export default class ExpressionSiteElement extends TwElement {
}
}
+ refreshHandler = () => {
+ return refreshApex(this.evaluatedWire);
+ }
+
get loading() {
return !this.computed && !this.error;
}
@@ -64,5 +80,6 @@ export default class ExpressionSiteElement extends TwElement {
return false;
}
- validate() {}
+ validate() {
+ }
}
diff --git a/expression-src/main/api/tests/CollectionFunctionsTest.cls b/expression-src/main/api/tests/CollectionFunctionsTest.cls
index 7d702137..5256282f 100644
--- a/expression-src/main/api/tests/CollectionFunctionsTest.cls
+++ b/expression-src/main/api/tests/CollectionFunctionsTest.cls
@@ -359,6 +359,21 @@ private class CollectionFunctionsTest {
Assert.areEqual('Child2', result[0]);
}
+ @IsTest
+ private static void combiningWhereAndMap_withRelationshipsBetweenDifferentSObjectTypes() {
+ Account parentAccount = new Account(Name = 'Parent');
+ insert parentAccount;
+
+ Contact childContact = new Contact(LastName = 'Child', AccountId = parentAccount.Id);
+ insert childContact;
+
+ String expr = 'MAP(WHERE(Contacts, BEGINS(LastName, "C")), Name)';
+ List