Skip to content

fix(grid): avoid NaN row counts before layout - #4365

Open
dvd233 wants to merge 1 commit into
alibaba:formily_nextfrom
dvd233:fix/grid-shadow-rows-4319
Open

dvd233 wants to merge 1 commit into
alibaba:formily_nextfrom
dvd233:fix/grid-shadow-rows-4319

Conversation

@dvd233

@dvd233 dvd233 commented Sep 19, 2026

Copy link
Copy Markdown

What changed?

  • Return 0 from Grid.rows and Grid.shadowRows before the grid has measurable columns.
  • Add a regression test for a newly created grid before it is connected to a layout container.

Why?

Before layout initialization or while a grid is being rebuilt, columns is 0. Dividing the current column totals by 0 returned NaN, which leaked into FormGrid consumers that read shadowRows during initialization or hot reload.

Verification

  • Regression test: baseline returned NaN; fixed code returns 0.
  • yarn tsc --noEmit --pretty false -p packages/grid/tsconfig.json passed.
  • ESLint passed for the changed source and test.
  • git diff --check passed.

Fixes #4319

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug Report] createFormGrid实例shadowRows热更新后值变为NaN

1 participant