Only request gadget mappings when "Show reduction" is on

Aperta Adatta ai principianti
#429 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript, playwright
Ambito
frontend, testing

Direzione di ricerca

Leggi components/widgets/VisualizationLogic.js e components/pageblocks/VisualizeRowReact.js per seguire il recupero dei gadget e i due interruttori. Segui il modello di monitoraggio delle richieste nei test di #390, poi esegui il test Playwright pertinente. Il lavoro è completato quando i gadget non possono essere attivati senza Show reduction, disattivando Show reduction si disattivano i gadget e la richiesta dei gadget viene inviata una volta quando entrambi sono attivi.

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

Descrizione

good first issue

Follow-up from the review of #390 (raised by @c-hayCodes when approving).

Why

Gadgets belong to a reduction, not to a problem on its own. The request is ProblemProvider/gadgets?reduction=<chosen reduction>, and it answers "which source pieces became which target pieces". With "Show reduction" off, the target pieces (reductionToIds) aren't on screen, so what's left is a grouping of the main picture's pieces that changes with the reduction dropdown even though no reduction is shown. That is confusing, so the gadget map should go with the reduction.

What happens now

The gadget map (and the solve and reduce requests behind it) is fetched when either "Show reduction" or "Highlight gadgets" is on: wantGadgets = visualizationState.reductionOn || visualizationState.gadgetsOn in components/widgets/VisualizationLogic.js. So turning on "Highlight gadgets" by itself still sends those requests.

What to change

  1. In components/widgets/VisualizationLogic.js, fetch the gadget map only when "Show reduction" is on (wantGadgets = visualizationState.reductionOn).
  2. In components/pageblocks/VisualizeRowReact.js, make "Highlight gadgets" depend on "Show reduction": disable the switch while "Show reduction" is off, and turn it off when "Show reduction" is turned off.
  3. Add a Playwright test: with "Show reduction" off, turning on "Highlight gadgets" isn't possible and no ProblemProvider/gadgets request is sent. With both on, the request is sent once. #390's tests show how to watch requests.

Out of scope

Changing how the renderers highlight (they also color the hovered piece without the gadget map) is #430.

Lingua principale
JavaScript
Stelle
3
Fork
18
Merge medio
3g 11h
PR unite (30g)
27

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Include un Dockerfile o un file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

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 ReduxISU/Redux_GUI

Tutte le issue di ReduxISU/Redux_GUI

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.