autosuggest fails on null values
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 42/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- frontend
Direzione di ricerca
Inizia in suggestions.js da replaceDiacritics e populateSuggestionsList, quindi riproduci il crash digitando in un DataSearch i cui dataFields includono valori null. Verifica come i suggerimenti null arrivano alla sostituzione dei diacritici e definisci la gestione necessaria affinché autosuggest non vada più in crash, mantenendo il comportamento di corrispondenza esistente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
We are utilizing reactivesearch to query some Elastic data. We are utilizing the showMissing prop option on several filters that are using MultiList. Our understanding is that missing/null data is necessary for showMissing to function and this is all working.
There is also a DataSearch. Today, I was asked to connect the DataSearch to more dataFields and some of those fields are null for some records. For the showMissing to function, I can't (as far as I know) avoid having these null values. When I added the additional fields to the DataSearch's dataFields, the app would crash as soon as I typed anything into the input.
Stack trace showed it was crashing at the str.replace in replaceDiacritics (in suggestions.js) because str had a value of null:
function replaceDiacritics(s) {
let str = s ? String(s) : s;
const diacritics = [
/[\300-\306]/g, /[\340-\346]/g, // A, a
/[\310-\313]/g, /[\350-\353]/g, // E, e
/[\314-\317]/g, /[\354-\357]/g, // I, i
/[\322-\330]/g, /[\362-\370]/g, // O, o
/[\331-\334]/g, /[\371-\374]/g, // U, u
/[\321]/g, /[\361]/g, // N, n
/[\307]/g, /[\347]/g, // C, c
];
const chars = ['A', 'a', 'E', 'e', 'I', 'i', 'O', 'o', 'U', 'u', 'N', 'n', 'C', 'c'];
for (let i = 0; i < diacritics.length; i += 1) {
str = str.replace(diacritics[i], chars[i]); // crash here
}
return str;
}
I won't say this is the best fix, but I put a band-aid on the issue by changing
const populateSuggestionsList = (val, parsedSource, source) => {
// check if the suggestion includes the current value
// and not already included in other suggestions
const isWordMatch = skipWordMatch || currentValue
.....
into
const populateSuggestionsList = (val, parsedSource, source) => {
// check if the suggestion includes the current value
// and not already included in other suggestions
val = val ? val : ''; // new
const isWordMatch = skipWordMatch || currentValue
.....
There may be reasons I'm not aware of that you wouldn't want to support the possibility of autosuggest encountering null values, but I thought I would open the issue to inquire if this was the intended behavior.
- Lingua principale
- JavaScript
- Stelle
- 33
- Fork
- 27
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
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 appbaseio/reactivecore
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 48/100
appbaseio/reactivecore#52 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
appbaseio/reactivecore#47 · 2 reazioni ·
-
Allow customization of GraphQL fetchForse di nuovo libera @lakhansamani l’ha presa 2180 giorni fa e non c’è nessuna pull request aperta. Aperta
appbaseio/reactivecore#42 · 2 commenti · 1 reazione · 1 assegnatario ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
appbaseio/reactivecore#29 · 4 commenti ·
-
Deprecated aggregation order key [_term] used, replaced by [_key]Forse di nuovo libera @metagrover l’ha presa 2909 giorni fa e non c’è nessuna pull request aperta. Aperta
appbaseio/reactivecore#19 · 2 commenti · 1 assegnatario ·
Tutte le issue di appbaseio/reactivecore
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
processing/p5.sound.js#123 ·
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 82/100
PhilflowIO/dav-mcp#146 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
Tanishq964/trail-kit.#4 ·
-
Request: <brand-name>Apertanew icon permissions in review
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
simple-icons/simple-icons#15067 ·
I maintainer di solito rispondono entro 1 giorno
-
status: needs triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
mastra-ai/mastra#26562 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno