Skip to main content

request_layout_invalidation

Function request_layout_invalidation 

Source
pub fn request_layout_invalidation()
Expand description

Requests a global layout re-run.

§⚠️ WARNING: Extremely Expensive - O(entire app size)

This triggers internal cache invalidation that forces every node in the app to re-measure, even if nothing changed. This is a performance footgun!

§Valid Use Cases (rare!)

Only use this for true global changes that affect layout computation everywhere:

  • Window/viewport resize
  • Global font scale or density changes
  • System-wide theme changes that affect layout
  • Debug toggles that change layout behavior globally

§For Local Changes - DO NOT USE THIS

If you’re invalidating layout for scroll, a single widget update, or any local change, you MUST use the scoped repass mechanism instead:

cranpose_ui::schedule_layout_repass(node_id);

Scoped repasses give you O(subtree) performance instead of O(app), and they don’t invalidate caches across the entire app.