-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(quantic): CRGA component not showing collapsed when answer appears without streaming #4840
Conversation
Pull Request ReportPR Title❌ Title should follow the conventional commit spec: Example: Live demo linksBundle Size
SSR Progress
Detailed logssearch : buildInteractiveResultsearch : buildInteractiveInstantResult search : buildInteractiveRecentResult search : buildInteractiveCitation search : buildGeneratedAnswer recommendation : missing SSR support case-assist : missing SSR support insight : missing SSR support commerce : missing SSR support |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a question of renaming the event so it better describes what it is.
And don't forget to move the two lines of comments that go with the code.
This is a very good example why the code should be "self-explanatory" in this case I chose to add those comments, may not have been the best idea, because now we need to remember to move those comments along with the code. FYI
...ic/force-app/main/default/lwc/quanticGeneratedAnswerContent/quanticGeneratedAnswerContent.js
Outdated
Show resolved
Hide resolved
...ges/quantic/force-app/main/default/lwc/quanticGeneratedAnswer/templates/generatedAnswer.html
Outdated
Show resolved
Hide resolved
packages/quantic/force-app/main/default/lwc/quanticGeneratedAnswer/quanticGeneratedAnswer.js
Outdated
Show resolved
Hide resolved
packages/quantic/force-app/main/default/lwc/quanticGeneratedAnswer/quanticGeneratedAnswer.js
Outdated
Show resolved
Hide resolved
7187613
to
326ed68
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice
…tedAnswer component (#4871) [SFINT-5855](https://coveord.atlassian.net/browse/SFINT-5855) ## IN THIS PR: - Added new property to the `quanticGeneratedAnswer` component called `maxCollapsedHeight` (same name as in Atomic). This property dictates what is the desired height of the generated answer before we collapse it. - Default value is still 250px - We now also have an accepted range from 150px to 500px, otherwise the default value is applied. Note: We want to merge this [PR](#4840) first since there will be conflicts. ## DEMO: #### Example when `maxCollapsedHeight` is within the acceptable range (here 151px is within 150 and 500px) <img width="760" alt="image" src="https://github.com/user-attachments/assets/6f281318-c9c9-4f64-87e0-4cc28bbef36e" /> OUTCOME: it caps the height to 151px since 151px is between 150 and 500px. #### Example when `maxCollapsedHeight` is outside the acceptable range (here 100px is NOT within 150 and 500px) <img width="1482" alt="image" src="https://github.com/user-attachments/assets/c3aaa141-995d-4254-979a-7356ad64c83d" /> OUTCOME: it displays the entire answer since the stated `maxCollapsedHeight` of 100px is NOT within 150 and 500px. Therefore, the answer height of 156px being smaller than 250px (Default height) is fully displayed. It also logs a warning in the console about this value of maxCollapsedHeight being outside the acceptable range. #### Example when `maxCollapsedHeight` is outside the acceptable range (here 600px is NOT within 150 and 500px) <img width="1596" alt="image" src="https://github.com/user-attachments/assets/83e62fd4-b395-4aab-be9f-25a71efd93a3" /> OUTCOME: it displays the entire answer since the stated `maxCollapsedHeight` of 600px is NOT within 150 and 500px. Therefore, the answer height of 195px being smaller than 250px (Default height) is fully displayed. It also logs a warning in the console about this value of maxCollapsedHeight being outside the acceptable range. ## UNIT TESTS: <img width="1024" alt="image" src="https://github.com/user-attachments/assets/e8c0a748-f0a2-44e2-bbf5-8a560ceec63a" /> [SFINT-5855]: https://coveord.atlassian.net/browse/SFINT-5855?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
SFINT-5914
ISSUE:
This is following a maintenance case where some cases of customers would trigger a CRGA answer directly without the stream. This would cause the answer to show fully rather than collapsed.
The culprit is caused by the following code:
The
generatedAnswerElementHeight
, whenisStreaming
is false ( case where the answer is generated in one shot rather than being streamed), is essentially 0. Therefore, thethis._exceedsMaximumHeight = 0 > 250px
which is false and therefore does not result in the answer being collapsed. This is happening since the component does not re-render and therefore does not re-calculates the height and CSS variables.SOLUTION:
Adding
quantic__answergenerated
event.We are proposing dispatching an event from the
quanticGeneratedAnswerContent
component when the answer's HTML is updated. We then listen for this event in thequanticGeneratedAnswer
component and recalculate the CSS variables.When the event is triggered, it calls this function:
E2E: