Handling undefined value in table columns?
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 153
- Fork
- 46
- Merge medio
- 1g 8h
- PR unite (30g)
- 7
Descrizione
In the issue-pane, it is currently possible for a category to have an undefined value, which then means it doesn't show up in the table view.
This occurs because the filterFunction defined by renderEnumSelector in table.js will never return true for an undefined colValue
https://github.com/solid/solid-ui/blob/c2d0c8aed526db4e35640d9f3d543434a2c310ec/src/table.js#L1121-L1123
Possible solutions
It is possible this is simply a bug. searchValue defaults to {}, so !searchValue will always be false, even though a comment may or may not suggest the intended behaviour was to return true:
https://github.com/solid/solid-ui/blob/c2d0c8aed526db4e35640d9f3d543434a2c310ec/src/table.js#L1099-L1103
In this case, a solution would be to use:
return Object.keys(searchValue).length == 0 || colValue && searchValue[colValue.uri];
However, given that the default behaviour of table.js is to select all options, and on a desktop there is currently no way of unselecting all options, the UI would also need to change.
Instead of a new UI element or interaction to deselect all options (let's call that Solution 1), another solution would then be to add an option for undefined, which would have the advantage of being able to show only those options missing a category (Solution 2).
And rather than doing that automatically within table.js, another option is to simply not support undefined values (and perhaps to include some validation code, Solution 3). issue-pane would then need to make sure that a default value is always assigned for a category.
Not sure which of solution 1-3 would be preferred.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
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.
Direzione di ricerca
Inizia dalle righe 1099-1123 di src/table.js e riproduci il comportamento della tabella dell’issue-pane con una categoria undefined. Confronta i tre comportamenti proposti — modifiche alla selezione, un’opzione undefined esplicita oppure validazione/impostazione dei valori predefiniti — con l’attuale UI della tabella, quindi conferma che il comportamento scelto copra sia la visualizzazione delle righe sia il loro filtraggio.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- typescript
- Ambito
- frontend
- Tipo di issue
- Bug
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 20/100