Skip to content

Commit

Permalink
fix(quantic): issue occurring with result title and quick view in sal…
Browse files Browse the repository at this point in the history
…esforce service console addressed (#4078)

## [SFINT-5571](https://coveord.atlassian.net/browse/SFINT-5571)


### The issue: 

An issue was occurring in the Service Console when trying to open a
result or its Quickview:


https://github.com/coveo/ui-kit/assets/86681870/7d3048d9-61aa-4e1d-a72c-e79fbf9a6e5e

This issue is duo to the Proxy object that Salesforce wraps the result
object with, this proxy object is causing issues when the Headless
library tries to use the result object.

### The solution:

Instead of using `Object.create(this.result)` that we used to use to
create a copy of the object and that apparently is no longer useful, I'm
now creating a new object after distructuring the result object and this
is doing the job preventing the errors from occuring:



https://github.com/coveo/ui-kit/assets/86681870/c71ea442-e183-4f04-91af-d2bc8cb71f25





[SFINT-5571]:
https://coveord.atlassian.net/browse/SFINT-5571?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Co-authored-by: Sylvie Allain <58052881+sallainCoveo@users.noreply.github.com>
  • Loading branch information
mmitiche and sallainCoveo authored Jun 12, 2024
1 parent 893d7a6 commit 71bc15b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ export default class QuanticResultLink extends NavigationMixin(
this.engine = engine;
ResultUtils.bindClickEventsOnResult(
this.engine,
this.result,
// Destructuring transforms the Proxy object created by Salesforce to a normal object so no unexpected behaviour will occur with the Headless library.
{...this.result, raw: {...this.result.raw}},
this.template,
this.headless.buildInteractiveResult
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ export default class QuanticResultQuickview extends LightningElement {
const {pushRecentResult} = this.headless.loadRecentResultsActions(
this.engine
);
this.engine.dispatch(pushRecentResult(Object.create(this.result)));

// Destructuring transforms the Proxy object created by Salesforce to a normal object so no unexpected behaviour will occur with the Headless library.
this.engine.dispatch(
pushRecentResult({...this.result, raw: {...this.result.raw}})
);
}

closeQuickview() {
Expand Down

0 comments on commit 71bc15b

Please sign in to comment.