Skip to content

fix: reuse tooltip instance for composite components#9639

Merged
web-padawan merged 1 commit into
mainfrom
fix/9638-reuse-tooltip-composite
Jun 30, 2026
Merged

fix: reuse tooltip instance for composite components#9639
web-padawan merged 1 commit into
mainfrom
fix/9638-reuse-tooltip-composite

Conversation

@web-padawan

Copy link
Copy Markdown
Member

Tooltip instances should be reused when calling Tooltip.forComponent repeatedly for the same component, as introduced in #4736. This did not work for composite components: the tooltip was stored on the original component, but the lookup in Tooltip#getForElement resolves the innermost content component instead, so the cached instance was never found and a new one was created on every call.

Component composite = new MyComposite(); // extends Composite<Span>
Tooltip a = Tooltip.forComponent(composite);
Tooltip b = Tooltip.forComponent(composite);
// a != b before this fix

Store the cached tooltip on the innermost component in forComponent, so the write matches the read in getForElement (and the existing forHasTooltip, which already resolves the innermost component).

Fixes #9638


🤖 Generated with Claude Code

Store the cached tooltip on the innermost component so the write in
forComponent matches the lookup in getForElement, which already resolves
the innermost component. Without this, composites stored the tooltip on
the composite but read it from the content component, creating a new
instance on every call.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@web-padawan web-padawan removed the request for review from sissbruecker June 30, 2026 08:01
@web-padawan web-padawan added this pull request to the merge queue Jun 30, 2026
Merged via the queue into main with commit 8fda378 Jun 30, 2026
26 checks passed
@web-padawan web-padawan deleted the fix/9638-reuse-tooltip-composite branch June 30, 2026 08:12
@vaadin-bot

Copy link
Copy Markdown
Collaborator

Hi @web-padawan and @web-padawan, when i performed cherry-pick to this commit to 25.1, i have encountered the following issue. Can you take a look and pick it manually?
Error Message:
Error: Command failed: git cherry-pick 8fda378
error: could not apply 8fda378... fix: reuse tooltip instance for composite components (#9639)
hint: After resolving the conflicts, mark them with
hint: "git add/rm ", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".

web-padawan added a commit that referenced this pull request Jun 30, 2026
Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

Reuse of Tooltip Instances Does Not Work for Composite Components

3 participants