Skip to content
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: handle list-box set before renderer #3412

Merged
merged 1 commit into from
Feb 9, 2022

Conversation

web-padawan
Copy link
Member

Description

Fixes vaadin/flow-components#2553

The way how Flow component works is not fully clear to me: for some reason, the original issue only manifests in Safari but not Chrome, and only on reattach. Finally, there has to be some other component present (see also #428).

However, I was able to reproduce the root cause with a test case that roughly mimics Flow connector:

  1. Create a list-box element and append it as a child in the constructor,
  2. In renderer function, move the list-box child to root element.

The actual problem: if menuElement.items is already defined by the time we initialize it, there will be no items-changed event fired. As a result, this._items will remain undefined and the subsequent renderer call will throw an error here:

const selected = this._items[this._menuElement.selected];

Type of change

  • Bugfix

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 9, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Member

@tomivirkki tomivirkki left a comment

Choose a reason for hiding this comment

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

I wasn't able to reproduce the original issue with Safari 15.2. But the fix is valid nonetheless, lgtm.

@web-padawan web-padawan merged commit c81899b into master Feb 9, 2022
@web-padawan web-padawan deleted the fix/select-list-box-child branch February 9, 2022 14:52
@vaadin-bot
Copy link
Collaborator

Hi @web-padawan , this commit cannot be picked to 22.0 by this bot, can you take a look and pick it manually?
Error Message: Error: Command failed: git cherry-pick c81899b
error: could not apply c81899b... fix: handle list-box set before renderer (#3412)
hint: after resolving the conflicts, mark the corrected paths
hint: with 'git add ' or 'git rm '
hint: and commit the result with 'git commit'

@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with platform 23.0.0.beta2 and is also targeting the upcoming stable 23.0.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.

Select throws a client side exception
3 participants