Skip to content

[Kbn grid layout] Use max_value instead of infinity#243572

Merged
ThomThomson merged 2 commits intoelastic:mainfrom
ThomThomson:kbnGridLayout/fixNoGutterResize
Nov 20, 2025
Merged

[Kbn grid layout] Use max_value instead of infinity#243572
ThomThomson merged 2 commits intoelastic:mainfrom
ThomThomson:kbnGridLayout/fixNoGutterResize

Conversation

@ThomThomson
Copy link
Contributor

@ThomThomson ThomThomson commented Nov 19, 2025

Summary

Fixes #243364 by using Number.MAX_VALUE instead of Infinity for the default maximum height of a panel.

Explanation

The tab crash was caused by the dragged panel on the Dashboard attempting to resize their height to NaN. The NaN came from the getRowCountInPixels function when attempting to calculate max pixel height of the panel to calculate the bottom of the preview rect:

Working case (main)

const rowCount = Infinity;
const rowHeight = 30;
const gutterSize = 8;

// ( Infinity * 30 = Infinity) + ( Infinity * 8 = Infinity  )  = Infinity
return rowCount * rowHeight + (rowCount - 1) * gutterSize

Broken case (main)

const rowCount = Infinity;
const rowHeight = 30;
const gutterSize = 0;

// ( Infinity * 30 = Infinity) + ( Infinity * 0 = NaN  )  = NaN
return rowCount * rowHeight + (rowCount - 1) * gutterSize

Fixed case (This PR)

const rowCount = MAX_VALUE;
const rowHeight = 30;
const gutterSize = 0;

// ( MAX_VALUE * 30 = Infinity) + ( MAX_VALUE * 0 = 0  )  = Infinity
return rowCount * rowHeight + (rowCount - 1) * gutterSize
@ThomThomson ThomThomson requested a review from a team as a code owner November 19, 2025 21:14
@ThomThomson ThomThomson added release_note:fix Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// loe:small Small Level of Effort impact:critical This issue should be addressed immediately due to a critical level of impact on the product. backport:version Backport to applied version labels v9.2.2 labels Nov 19, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

Copy link
Contributor

@nickpeihl nickpeihl left a comment

Choose a reason for hiding this comment

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

LGTM! I tested this and it seemed to resolve my issues with freezing tabs.

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
dashboard 663.8KB 663.8KB +59.0B
@ThomThomson ThomThomson merged commit a5a7e5c into elastic:main Nov 20, 2025
12 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 9.2

https://github.com/elastic/kibana/actions/runs/19542978747

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 20, 2025
Uses `Number.MAX_VALUE` instead of `Infinity` for the default maximum height of a panel.

(cherry picked from commit a5a7e5c)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
9.2

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Nov 20, 2025
…243691)

# Backport

This will backport the following commits from `main` to `9.2`:
- [[Kbn grid layout] Use max_value instead of infinity
(#243572)](#243572)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Devon
Thomson","email":"devon.thomson@elastic.co"},"sourceCommit":{"committedDate":"2025-11-20T15:56:36Z","message":"[Kbn
grid layout] Use max_value instead of infinity (#243572)\n\nUses
`Number.MAX_VALUE` instead of `Infinity` for the default maximum height
of a
panel.","sha":"a5a7e5c065633ab79cfabf6964b2c06fc6d8b3cc","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Presentation","loe:small","impact:critical","backport:version","v9.3.0","v9.2.2"],"title":"[Kbn
grid layout] Use max_value instead of
infinity","number":243572,"url":"https://github.com/elastic/kibana/pull/243572","mergeCommit":{"message":"[Kbn
grid layout] Use max_value instead of infinity (#243572)\n\nUses
`Number.MAX_VALUE` instead of `Infinity` for the default maximum height
of a
panel.","sha":"a5a7e5c065633ab79cfabf6964b2c06fc6d8b3cc"}},"sourceBranch":"main","suggestedTargetBranches":["9.2"],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/243572","number":243572,"mergeCommit":{"message":"[Kbn
grid layout] Use max_value instead of infinity (#243572)\n\nUses
`Number.MAX_VALUE` instead of `Infinity` for the default maximum height
of a
panel.","sha":"a5a7e5c065633ab79cfabf6964b2c06fc6d8b3cc"}},{"branch":"9.2","label":"v9.2.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Devon Thomson <devon.thomson@elastic.co>
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
eokoneyo pushed a commit to eokoneyo/kibana that referenced this pull request Dec 2, 2025
Uses `Number.MAX_VALUE` instead of `Infinity` for the default maximum height of a panel.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels impact:critical This issue should be addressed immediately due to a critical level of impact on the product. loe:small Small Level of Effort release_note:fix Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// v9.2.2 v9.3.0

4 participants