2.0.0-rc.21: isPending clears before a changed optimistic result is revealed

Aperta
#4,685 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
javascript, typescript
Ambito
frontend

Direzione di ricerca

Start by reading the isPending implementation and the optimistic memo handling that feeds it; the issue does not name files or tests, so trace those entry points from the reproduction. Reproduce with the linked playground and check how pending state changes when the memo resolves at 500 ms while its displayed value remains 0. Done means pending stays true until the changed value is revealed at 1000 ms, with a regression test covering this sequence.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug

An async memo derived from an optimistic value can report isPending(left) === false while its changed result is still held and the UI displays the previous value.

In the repro, left and right feed a shared total memo. Left resolves to 10 after 500 ms, but its displayed value remains 0 until right resolves after 1000 ms. Pending clears at 500 ms, before that change is revealed.

Your Example Website or App

https://s.olid.uk/id/U6ma1avLRKuXWGhrzWMEkQ

Steps to Reproduce the Bug or Issue
  1. Open the repro and click Run.
  2. Initially, left shows 0, left pending is true, and total is 0.
  3. After 500 ms, left pending becomes false, but left and total still show 0.
  4. After 1000 ms, left changes to 10 and total to 30, even though left pending had already become false.

The final values stay visible; reload to repeat.

Expected behavior

isPending(left) should stay true until the changed value 10 is revealed at 1000 ms.

Clearing pending early when the answer equals the displayed value is valid, but this answer is different: the displayed value is 0 and the ready answer is 10.

Screenshots or Videos

No response

Platform
  • Solid: 2.0.0-rc.21 (pinned in the repro)
  • OS: Debian GNU/Linux 13
  • Browser: Chromium 154.0.8037.57
Additional context

The action intentionally waits on a never-resolving promise so the optimistic values do not revert after the demonstration. Both memo requests resolve normally, at 500 ms and 1000 ms.

Verified in the hosted playground. Tailwind is disabled.

Lingua principale
TypeScript
Stelle
36.2k
Fork
1.1k
Merge medio
9h 56m
PR unite (30g)
487

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di solidjs/solid

Tutte le issue di solidjs/solid

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.