Skip to content

Remove card reflow layout shift on Models and Generative - #1072

Open
Irozuku wants to merge 3 commits into
developfrom
fix/card-reflow-cls
Open

Irozuku wants to merge 3 commits into
developfrom
fix/card-reflow-cls

Conversation

@Irozuku

@Irozuku Irozuku commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

The option cards on Models and Generative moved after their first paint. There were three causes: the menu painted 3 columns before a ResizeObserver switched to 1 or 2, each card measured its own height in JavaScript after paint, and on Models the no datasets alert showed while datasets were still loading. Columns now come from CSS container queries, card heights from grid rows, and the alert waits until datasets have loaded.

Page (Lighthouse CLS) Mobile before Mobile after Desktop before Desktop after
Models 0.179 0.0007 0.138 0.002
Generative 0.005 0.0007 0.002 0.002

On top of the performance branch, Generative mobile goes from 0.121 to 0.0009. The CLS that remains comes from the app bar logo.


Type of Change

  • Backend change
  • Frontend change
  • CI / Workflow change
  • Build / Packaging change
  • Bug fix
  • Documentation

Changes (by file)

  • DashAI/front/src/components/threeSectionLayout/SelectOptionMenu.jsx: CSS grid with container query columns and equal height rows, instead of a ResizeObserver and measured heights
  • DashAI/front/src/components/threeSectionLayout/OptionBox.jsx: removes the self measuring code
  • DashAI/front/src/hooks/datasets/useDatasets.js: adds datasetsLoaded, set once the first fetch settles
  • DashAI/front/src/contexts/DatasetsContext.jsx: passes datasetsLoaded through
  • DashAI/front/src/components/models/ModelsContext.jsx: passes datasetsLoaded through
  • DashAI/front/src/components/models/ModelCenterContent.jsx: shows the no datasets alert only after datasets load

Testing (optional)

  • Open Models and Generative at mobile and at desktop width: the cards appear in their final place, in the right number of columns, without jumping.
  • On Models with datasets, the no datasets alert never flashes; with no datasets, it shows.
  • The Data module landing still shows its cards as before.

Notes (optional)

Every card now matches the tallest one exactly; before, the others were about 2.6 px shorter because the old measurement ignored the card border.

@Irozuku Irozuku added bug Something isn't working front Frontend work labels Dec 2, 2026

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

bug Something isn't working front Frontend work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant