[RENDERER]: keyed lists with a repeat() directive
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 45/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- javascript
- Ambito
- frontend
Direzione di ricerca
Start with diffChildNodes() and parseArray() to understand how child node parts and index-based array parts are updated; this issue depends on #184. Then trace how template parts handle rendering, hydration, and toString(). Done means keyed rows keep their DOM state through sorting, the benchmark includes keyed swap and remove cases, and docs/features/templates.md documents the directive.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Goal
A list whose items move keeps the DOM nodes of each item, so focus, input values, scroll position and running animations survive a sort or an insert at the front.
Context
diffChildNodes() works on node identity and parseArray() reuses the template part at each index when the literal is the same. A sort therefore updates every row in place with the values of another item instead of moving the rows. That is fast (swap rows is under a millisecond in the benchmark), but any state that lives in the DOM ends up on the wrong item.
Design
html`<ul>${repeat(items, (item) => item.id, (item) => html`<li>${item.name}</li>`)}</ul>`
repeat()is a directive on a child node part, it returns a value the part recognises- the part keeps a
Map<key, TemplatePart>instead of the index basedarrayParts - a key that exists gets its part updated and its nodes moved to the new position, a new key gets a new part, a missing key has its nodes removed
toString()renders the items in order, nothing else to do on the server- hydration binds the parts to the server rendered template markers in order, like arrays do today
Builds on the array handling of #184, do it after that one.
Done when
- a sort of 1000 rows moves nodes instead of rewriting them: a focused input in a row stays focused and keeps its value
- the benchmark gets a keyed variant of swap rows and remove row
- documented in
docs/features/templates.mdnext to the other directives
- Lingua principale
- JavaScript
- Stelle
- 30
- Fork
- 5
- Merge medio
- 1h 57m
- PR unite (30g)
- 10
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di webtides/element-js
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
webtides/element-js#201 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
webtides/element-js#198 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
webtides/element-js#194 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
webtides/element-js#193 ·
I maintainer di solito rispondono entro 1 giorno
-
[RENDERER]: only the first raw text element with interpolations is handled, a line break inside one breaks it tooForse già presa @eddyloewen l’ha presa 28 giorni fa. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
webtides/element-js#185 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di webtides/element-js
Issue simili
-
area:testing bug effort:low model:light plan planner:gpt-6-2-sol tests
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
enhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
Agent360dk/browser-mcp#124 ·
I maintainer di solito rispondono entro 2 giorni
-
area:site feature good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
pacocartones/free-llm-api-hub#829 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
Jason-Vaughan/TangleClaw#3270 ·
I maintainer di solito rispondono entro 1 giorno