An Activity that rerenders in the same mode walks its whole retained subtree
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 30/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- react, typescript
- Área
- performance
Línea de trabajo
Start with renderActivity in dom/features/activity/full.ts and trace its prepare/syncDom and reconnect walks for an Activity whose mode stays the same. The issue includes a reproducer and reports tests on an existing branch, including a fiber read count test; inspect those tests and verify reveal and hide behavior remains unchanged. Done means same-mode rerenders skip the retained subtree walk while mode changes still process it.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Rerendering an <Activity> whose mode did not change still walks every retained fiber below it, twice. With 2,000 memoized rows inside, a parent rerender takes 28 ms per update on main, against 0.04 ms on React 19.3.0, which only traverses an Activity's subtree when its visibility changes.
import { Activity, memo, useLayoutEffect, useState } from 'react'
const Row = memo(({ id }: { id: number }) => {
useLayoutEffect(() => () => {}, [])
return <li>{id}</li>
})
const Rows = memo(() => <ul>{Array.from({ length: 2000 }, (_, id) => <Row key={id} id={id} />)}</ul>)
export function Example() {
const [tick, setTick] = useState(0)
return <>
<button onClick={() => setTick(value => value + 1)}>Rerender {tick}</button>
<Activity mode="visible"><Rows /></Activity>
</>
}
renderActivity (dom/features/activity/full.ts) runs its prepare/syncDom walk and its reconnect walk on every render. Walking only when the mode changes is enough: children that render are already prepared and synced as they render, the rest keep the state the last mode change gave them, and an Activity above that changes mode walks the subtree itself.
That is 13 lines, and I have it on a branch with tests, since PRs are limited to collaborators. Happy to open one if you want it, or take the idea as is:
https://github.com/TanStack/redact/compare/main...santiago-ramos-02:redact:perf/activity-skip-activity
- Speed: same-mode rerender 28.0 to 1.15 ms per update, -95.9% (95% interval -96.3% to -89.8%). Reveal and hide are unchanged.
- Size: +9 B gzip on the default client (23,411 to 23,420), 0 on
nano. Every fixed budget insize-check.mjspasses unchanged. - Tests: on the branch, including one that counts fiber reads over the retained subtree during a same-mode rerender and fails on
main(301 per Activity, expected 0).
- Lenguaje dominante
- TypeScript
- Estrellas
- 581
- Forks
- 28
- Merge medio
- 13 h 48 min
- PR fusionados (30 d)
- 45
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de TanStack/redact
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
TanStack/redact#142 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
`lazy(memo(Component))` doesn't re-render on store update when an ancestor reads the same storeAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
TanStack/redact#166 · 1 reacción ·
Los mantenedores suelen responder en 1 día
Todos los issues de TanStack/redact
Issues similares
-
bot:ai-assisted component:platform-js status:untriaged
Dificultad 1/5 Menos de una hora Aptitud para principiantes 74/100
midnightntwrk/platform-js#38 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
ranxianglei/billion-context#7068 ·
Los mantenedores suelen responder en 1 día
-
vendor: bump whisper.cpp past 6a8addd — the current pin aborts the app on a failed Metal initAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
mybigday/whisper.rn#348 ·
-
enhancement severity:low
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Battle-Cattle/BCUK-Bot-4#1075 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
ilan-pinto/roaring-lions#1552 ·
Los mantenedores suelen responder en 1 día