Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

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

Ouverte
#4,032 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
48/100
Type d'issue
Bug
Clarté
Plutôt claire
Activité
Active
Stack technique
javascript, react

Piste de recherche

Start in the dash-renderer implementation of selectDashProps, determineChangedProps, isFirstLevelPropsChild, and the layoutHashes state path. Reproduce the repeated scans with flagged dashChildrenUpdate components, then evaluate an indexing or per-update approach while confirming that children still update correctly and the measured rendering cost improves.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

bug P2 size: 3

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.

Langage dominant
Python
Étoiles
24.4k
Forks
2.3k
Merge moyen
2 j 13 h
PR mergées (30 j)
20

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de plotly/dash

Toutes les issues de plotly/dash

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.