Skip to content

fix: improve custom editors internal structure to prevent NPE errors #7755

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

Merged
merged 20 commits into from
Jul 31, 2025

Conversation

DiegoCardoso
Copy link
Contributor

Description

Sometimes, the call to removeCellCustomEditor can be done to a widget already removed from its parent, which causes a client-side error.

This change tries to address that with some refactoring on the custom editors' internal map.

The refactor aims to replace the keys that currently refer to the cell address with the editor ID itself. That way, in case the same editor is shared by more than one cell, the same Slot will be used. With the current logic, more than one Slot element would be created for the same editor, which could cause issues like the editor not being shown because it was moved to the other Slot parent.

Type of change

  • Bugfix / Refactor

Use the top and left frozen panel size to calculate the amount of
headers and rows to be rendered when the user scrolls. Currently, the
size of the frozen panels are not accounted which causes some of the
columns and rows to not be rendered even when there's available space
for that.

Fixes #7507
Sometimes, the call to `removeCellCustomEditor` can be done to a widget
already removed from its parent, which causes a client-side error.

This change try to address that with some refactor on the custom editors
internal map.

The refactor aims to replace the keys that currently refer to the cell
address with the editor ID itself. That way, in case the same editor is
shared by more than one cell, the same `Slot` will be used. With the
current logic, more than one `Slot` element would be created for the
same editor, which could cause issues like, the editor not being shown
because it was moved to the other `Slot` parent.
Base automatically changed from fix/spreadsheet/frozen-pane to main July 28, 2025 10:58
@DiegoCardoso DiegoCardoso marked this pull request as ready for review July 28, 2025 13:08
@DiegoCardoso DiegoCardoso requested a review from ugur-vaadin July 28, 2025 13:08
@DiegoCardoso DiegoCardoso requested a review from ugur-vaadin July 30, 2025 14:44
@DiegoCardoso DiegoCardoso enabled auto-merge (squash) July 31, 2025 14:32
Copy link

@DiegoCardoso DiegoCardoso merged commit c574610 into main Jul 31, 2025
5 checks passed
@DiegoCardoso DiegoCardoso deleted the fix/spreadsheet/prevent-npe-custom-editors branch July 31, 2025 15:02
vaadin-bot pushed a commit that referenced this pull request Jul 31, 2025
…7755)

* fix: prevent trying to remove already removed

Sometimes, the call to `removeCellCustomEditor` can be done to a widget
already removed from its parent, which causes a client-side error.

This change try to address that with some refactor on the custom editors
internal map.

The refactor aims to replace the keys that currently refer to the cell
address with the editor ID itself. That way, in case the same editor is
shared by more than one cell, the same `Slot` will be used. With the
current logic, more than one `Slot` element would be created for the
same editor, which could cause issues like, the editor not being shown
because it was moved to the other `Slot` parent.
vaadin-bot pushed a commit that referenced this pull request Jul 31, 2025
…7755)

* fix: prevent trying to remove already removed

Sometimes, the call to `removeCellCustomEditor` can be done to a widget
already removed from its parent, which causes a client-side error.

This change try to address that with some refactor on the custom editors
internal map.

The refactor aims to replace the keys that currently refer to the cell
address with the editor ID itself. That way, in case the same editor is
shared by more than one cell, the same `Slot` will be used. With the
current logic, more than one `Slot` element would be created for the
same editor, which could cause issues like, the editor not being shown
because it was moved to the other `Slot` parent.
DiegoCardoso added a commit that referenced this pull request Jul 31, 2025
…7755) (#7773)

* fix: prevent trying to remove already removed

Sometimes, the call to `removeCellCustomEditor` can be done to a widget
already removed from its parent, which causes a client-side error.

This change try to address that with some refactor on the custom editors
internal map.

The refactor aims to replace the keys that currently refer to the cell
address with the editor ID itself. That way, in case the same editor is
shared by more than one cell, the same `Slot` will be used. With the
current logic, more than one `Slot` element would be created for the
same editor, which could cause issues like, the editor not being shown
because it was moved to the other `Slot` parent.

Co-authored-by: Diego Cardoso <diego@vaadin.com>
DiegoCardoso added a commit that referenced this pull request Jul 31, 2025
…7755) (#7772)

* fix: prevent trying to remove already removed

Sometimes, the call to `removeCellCustomEditor` can be done to a widget
already removed from its parent, which causes a client-side error.

This change try to address that with some refactor on the custom editors
internal map.

The refactor aims to replace the keys that currently refer to the cell
address with the editor ID itself. That way, in case the same editor is
shared by more than one cell, the same `Slot` will be used. With the
current logic, more than one `Slot` element would be created for the
same editor, which could cause issues like, the editor not being shown
because it was moved to the other `Slot` parent.

Co-authored-by: Diego Cardoso <diego@vaadin.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.

3 participants