Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

latest() of an unread identity memo returns undefined when first read in the flush that re-asks its source

Abierto
#4,474 0 comentarios 0 reacciones 0 asignados Ver en GitHub

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
52/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
typescript
Área
frontend

Línea de trabajo

Start with the issue’s reproducer and trace the first read of latest(id) alongside isPending(id) when the Loading boundary mounts. Compare that case with creating the identity memo inside the mounted content, where the bug does not occur. Done when the reproducer no longer yields latest(id) === undefined after m has answered, while pending behavior remains correct.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

On next (e49b0c769), latest() can return undefined, which D-22 rules out ("It returns T, never undefined").

Setup:

  • m is an async memo, and id = createMemo(() => m()) is an identity memo created at the root. Nothing reads id yet.
  • m's first answer (2) lands in its own flush.
  • A write then re-asks m. In that same flush, a Loading boundary mounts content whose render effect reads latest(id) and isPending(id).

The effect's first run sees latest(id) === undefined and isPending(id) === true. Because m has been answered, latest(id) should be 2. If id is created inside the mounted content instead, the bug does not happen.

const asks: { v: number; resolve: (v: number) => void }[] = [];
const [s, setS] = createSignal(1);
const m = createMemo(() => { const v = 1 + s(); return new Promise<number>(resolve => asks.push({ v, resolve })); });
const id = createMemo(() => m());
const leaves: string[] = [];
createRoot(() => {
  const b = createLoadingBoundary(() => {
    const gate = createMemo(() => s() > 1);
    return createMemo(() => {
      if (!gate()) return "off";
      createRenderEffect(() => `l:${latest(id)} p:${isPending(id)}`, v => void leaves.push(v));
      return "on";
    });
  }, () => "fallback");
  createRenderEffect(() => { let v: any = b; while (typeof v === "function") v = v(); return v; }, () => {});
});
flush(); await task(); flush();
const first = asks.shift()!; first.resolve(first.v);
await task(); flush();          // m's answer (2) lands on its own
setS(2); await task(); flush(); // re-ask m and mount the content
// leaves: ["l:undefined p:true", ...]

Found while reviewing #4459; #4459 does not change it.

Lenguaje dominante
TypeScript
Estrellas
36.2k
Forks
1.1k
Merge medio
11 h 48 min
PR fusionados (30 d)
441

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de solidjs/solid

Todos los issues de solidjs/solid

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.