SolidJSS
SolidJSโ€ข3y agoโ€ข
1 reply
romanobro

html not rendering consistently inside span

onFocusOut={() => { const newText = document.getElementById(id)?.innerHTML updateNote(id, newText) }}
and
const updateNote = (id: string, newText: any) => { const notesList = notes() const index = notesList.findIndex(note => note.id === id) if (index !== -1) { const oldNote = notesList[index] console.log(newText) oldNote.text = newText console.log(oldNote) const updatedNotes = [...notesList] updatedNotes.splice(index, 1, oldNote) setNotes(updatedNotes) } }
finally, the notes type contains text:any and a unique id.
This is especially confusing because it seems to work randomly. You can see the notes objects and the inner html being logged on the right. Any help would be much appreciated, thank you.
Was this page helpful?