Skip to content

dash-renderer: determineChangedProps scans every layoutHashes entry for each dashChildrenUpdate component on every store update #4032

Todo

Description

@j-azeo

Versions: dash 3.4.0 (the same code is in 4.4.1), dash-mantine-components 2.5.1, Chromium.

What happens. In selectDashProps, a component whose type sets dashChildrenUpdate calls determineChangedProps(state, strPath). That function iterates Object.entries(state.layoutHashes) and calls isFirstLevelPropsChild, which does two split(',') calls per entry. It does this for every flagged component, on every Redux store update (callback responses, loading-state and request bookkeeping included). layoutHashes gains one entry per path whose props ever changed and never shrinks. So the cost is roughly O(flagged components × changed paths × store updates), and it grows the longer a tab stays open.

Why it bites. DMC sets the flag on MenuItem, MenuDropdown, MenuLabel, SubMenu*, Tooltip, FloatingTooltip, PopoverDropdown, HoverCardDropdown, Stepper and Timeline; dcc sets it on Tabs. An app with a keepMounted header menu (which callbacks inside a closed menu require) and tooltips on navbar links has dozens of flagged components mounted on every page.

Measured (production app; CPU profile via the Chrome DevTools Protocol; headless Chromium; 5 full loads per page):

  • The anonymous isFirstLevelPropsChild comparison was the single hottest function. It took 0.84–2.07 s of main-thread time between a page's layout arriving and its content rendering.
  • Deleting dashChildrenUpdate from the DMC menu and tooltip types before the renderer reads them made page content appear 1.5–2.2× sooner, e.g. 2.83 s → 1.54 s and 5.36 s → 2.56 s. Main-thread busy time fell 3–4×.
  • Children inside those components still updated correctly.

Possible fixes:

  • Index layoutHashes by parent path, so a component only looks at its own direct children.
  • Or compute the descendant hash once per store update rather than once per flagged component.
  • Or let component libraries opt out per type when nothing in the type reads its children's props.

Workaround we use: an inline <head> script, defined before the component bundles load, that traps window.dash_mantine_components and deletes the flag from the menu and tooltip types.

Activity

  1. AnnMarieW commented on Oct 1, 2026

    @AnnMarieW
    Collaborator

    @j-azeo - Thanks for reporting.

    Can you please try dash v4.5.0rc0 There was some work done on similar issues. It may not cover this use-case, but it would be good to know.

  2. added
    bug
    P2
    on Oct 1, 2026
  3. davidpasquale-turboden commented on Nov 19, 2026

    @davidpasquale-turboden

    Still there on dash 4.5.0 (final), dash-mantine-components 2.8.1, Edge (Chromium) 157, minified bundles. Our page has ~2,700 components and layoutHashes holds ~810 entries after a case is loaded.
    With the components of the types that set dashChildrenUpdate left as they are, the page does not come to rest within 3 minutes after a callback replaces its sections' children; with dashChildrenUpdate deleted from those types in the browser before the layout is drawn, the same load takes 3 s.
    On a smaller page (~1,370 components, ~420 entries) a change of options that redraws every section takes 13.6 s with the flag and
    4.4 s without. The function is the same in 4.4.1.
    #4103 looks like it would address it - is anything blocking a review?

  4. camdecoster commented on Nov 19, 2026

    @camdecoster
    Contributor

    @davidpasquale-turboden thanks for the report. Our team reviewed that PR and is just waiting for an update from the author, but it will likely get merged soon.

  5. added theissue type on Nov 25, 2026
  6. self-assigned this
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2bugsize: 3

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions