Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

bug(@typegpu/react): useConfigureContext ignores option changes after mount

Aperta
#3,216 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
72/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
react, typescript
Ambito
frontend

Direzione di ricerca

Find useConfigureContext in the React package and trace when it calls the WebGPU context's configure method. Check how the hook observes option changes and compares values, especially for viewFormats. Add or update tests for changing options after mount, then confirm reconfiguration occurs when values change and not just when array references change.

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

Descrizione

useConfigureContext only configures the context when the canvas attaches (or when the root changes), so changing any of its canvas options after the first mount (alphaMode, colorSpace, format, toneMapping, usage, viewFormats) is silently ignored.

function Canvas({ transparent }: { transparent: boolean }) {
  const { ref } = useConfigureContext({
    alphaMode: transparent ? 'premultiplied' : 'opaque',
  });
  return <canvas ref={ref} />;
}

// Mounting with `transparent={false}` configures the context with `alphaMode: 'opaque'`.
// Re-rendering with `transparent={true}` never calls `configure` again, so the canvas stays opaque.

The context should be reconfigured whenever the options change, comparing them by value (e.g. viewFormats is an array, which would otherwise be a new reference on every render).

Lingua principale
TypeScript
Stelle
3.3k
Fork
135
Merge medio
4g 1h
PR unite (30g)
64

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 software-mansion/TypeGPU

Tutte le issue di software-mansion/TypeGPU

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.