Skip to content

fix(atomic) issue with the Atomic-generated-answer collapsible parameter is not working as expected#7240

Merged
SimonMilord merged 1 commit intomainfrom
SFINT-6691
Mar 18, 2026
Merged

fix(atomic) issue with the Atomic-generated-answer collapsible parameter is not working as expected#7240
SimonMilord merged 1 commit intomainfrom
SFINT-6691

Conversation

@SimonMilord
Copy link
Copy Markdown
Contributor

@SimonMilord SimonMilord commented Mar 16, 2026

SFINT-6691

This is following a support case from a client, the issue was introduced in v3.52.1

ISSUE:

The answer collapse behaviour was inconsistent because the collapsibility of the answer depended on measured content height too early in the lifecycle. This could prevent long answers from appearing collapsible even when collapsible was enabled.

SOLUTION:

The fix ensures resize observation starts whenever collapsible is enabled, so answer height is measured and updated reliably after render. Collapsibility is then applied only when all required conditions are met: collapsible=true, follow-ups are not enabled, and content height exceeds the configured collapsed height. This guarantees that follow-up mode is never collapsible while preserving correct collapse/expand behaviour for long single answers.

Why not just change the isCollapsibleEnabled ?

Because they solve different problems.

isCollapsibleEnabled is :

  • collapsible prop is on
  • follow-ups are off
  • measured height is above threshold

The initialization condition controls whether measurement starts at all ( ResizeObserver setup)

If that condition depends on isCollapsibleEnabled, it creates a  problem: height is unknown before observing, so isCollapsibleEnabled is initially false, so observer never starts, so height never updates.

So the observer condition should stay broad (this.collapsible) to start measuring, while isCollapsibleEnabled should stay strict to decide when collapse UI is actually enabled.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the initialization logic for the generated answer’s collapsible behavior so height measurement can run when collapsible is enabled, and updates unit tests to reflect the intended collapsible enable/disable semantics.

Changes:

  • Initialize the ResizeObserver when the collapsible prop is enabled (instead of gating on isCollapsibleEnabled, which depends on an already-measured height).
  • Adjust and rename tests to validate renderAnswerContent receives the correct collapsible value when the feature is disabled/enabled.
  • Update test height values to ensure “tall content” reliably exceeds maxCollapsedHeight.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/atomic/src/components/search/atomic-generated-answer/atomic-generated-answer.ts Fixes ResizeObserver initialization gating to allow measuring height when collapsible is enabled.
packages/atomic/src/components/search/atomic-generated-answer/atomic-generated-answer.spec.ts Updates collapsible-related assertions and test setup to match the corrected initialization behavior.

Copy link
Copy Markdown
Collaborator

@erocheleau erocheleau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@SimonMilord SimonMilord added this pull request to the merge queue Mar 18, 2026
Merged via the queue into main with commit ea7fcbd Mar 18, 2026
73 checks passed
@SimonMilord SimonMilord deleted the SFINT-6691 branch March 18, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants