fix(layout): reserve UpdateBanner height to kill admin login layout shift #167
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/PMS-313-update-banner-layout-shift"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes the admin "Update available" banner causing a layout shift on every admin login (PMS-313). The banner's version check is async; the component rendered nothing until it resolved, then popped a ~40px row in and pushed the TopBar, sidebar nav, and main content down. Non-zero CLS on every admin login on a stale client, repeated on every AppLayout re-mount.
Approach (reserved-height container, option 1 from the issue)
For admins the outer container now always renders, so the banner height is reserved from first paint:
Reserving): reserve one banner-line of height via a transparent spacer atopacity-0. Invisible on first paint, but the geometry is already final.Show): fade the banner into the already-reserved space. Zero shift, which is the case the bug was about.Collapsed): collapse the reserved height away.Collapse uses the
grid-template-rows: 1fr -> 0frpattern withtransition-all duration-200 ease-in-out, so it animates to the content's natural height with no hard-coded pixel value and no clipping of a wrapped multi-line banner on narrow viewports. Dismiss runs through the same collapse transition.Notes
is_adminearly-return is unchanged, so they get no reserved band and no extra render.use_auth/use_signal/use_resourceall run before any return), preserving the Dioxus stable-hook-set invariant the original code documented.hooks/update_check.rs, which is the unrelated SPA auto-reload hook), banner wording, and the dismiss persistence key.Verification
cargo fmt --check,cargo check --target wasm32-unknown-unknown, andcargo clippy --all-targets -D warningsall clean. Tailwind v4 emits the newgrid-rows-[0fr]/grid-rows-[1fr]utilities (confirmed in the generatedassets/styles.css).Acceptance criteria mapping:
#PMS-313