Skip to content

fix: access UI through container element in ComponentRenderer - #6759

Merged
vursen merged 3 commits into
mainfrom
6751-fix-component-renderer-regression-
Oct 31, 2024
Merged

vursen merged 3 commits into
mainfrom
6751-fix-component-renderer-regression-

Conversation

@vursen

@vursen vursen commented Oct 30, 2024 •

Copy link
Copy Markdown
Contributor

Description

Using UI.getCurrent() isn't safe because even when the container is attached, it may return null. This PR updates the ComponentRenderer implementation to access the UI instance through the container element where it's guaranteed to be available if the container is attached.

Fixes #6751

Type of change

  • Bugfix

@vursen
vursen force-pushed the 6751-fix-component-renderer-regression- branch 2 times, most recently from 5e2ded3 to c4d8969 Compare October 30, 2024 11:31
@vursen
vursen force-pushed the 6751-fix-component-renderer-regression- branch from c4d8969 to 3fc33e1 Compare October 30, 2024 11:33
}

@Test
public void addComponentRendererBeforeAttach_componentIsRendered() {

@vursen vursen Oct 30, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

note: This is a modern version of the previous test which covered #5534

@vursen
vursen marked this pull request as ready for review October 30, 2024 11:42
@sonarqubecloud

Copy link
Copy Markdown

@vursen
vursen merged commit d4c616c into main Oct 31, 2024
@vursen
vursen deleted the 6751-fix-component-renderer-regression- branch October 31, 2024 08:23
@vaadin-bot

Copy link
Copy Markdown
Collaborator

Hi @vursen and @vursen, when i performed cherry-pick to this commit to 24.4, i have encountered the following issue. Can you take a look and pick it manually?
Error Message:
Error: Command failed: git cherry-pick d4c616c
error: could not apply d4c616c... fix: access UI through container element in ComponentRenderer (#6759)
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".

@vaadin-bot

Copy link
Copy Markdown
Collaborator

This ticket/PR has been released with Vaadin 24.6.0.alpha2 and is also targeting the upcoming stable 24.6.0 version.

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.

[Regression] JS error occurs when ComponentRenderer is created in a background thread

4 participants