New tag component - #100
Conversation
| }) | ||
| } | ||
|
|
||
| updateBiomarkerTag = async ( |
There was a problem hiding this comment.
Dos correcciones sobre esta función:
- Documentala con JSDocs como hacemos con todas las demás.
- Pasalo a promises en vez de async/try/catch. Pedile a cualquier LLM que te haga la conversión. Pero estamos haciendo así en todo el proyecto, prefiero que no quede mixto. Después voy a ver si puedo agregar una regla de ESLint para que advierta sobre esto
| .finally(() => setLoadingTags(false)) | ||
| } | ||
|
|
||
| // Fetches all the Tags as soon as the component is mounted |
There was a problem hiding this comment.
Poner como JSDocs (es decir, con la sintaxis /** ... */). De esa manera los IDEs pueden renderizarla cuando se le hace hover con el mouse
| setNewTag(getDefaultNewTag()) | ||
| } | ||
|
|
||
| // Keeps the internal selection in sync if the parent updates the Tag from outside |
There was a problem hiding this comment.
Idem comentario anterior sobre JSDocs
| } | ||
|
|
||
| // Keeps the internal selection in sync if the parent updates the Tag from outside | ||
| // while the panel is closed (e.g. after a refresh of the underlying data) |
There was a problem hiding this comment.
Idem comentario anterior sobre JSDocs
| handleClose() | ||
| } | ||
|
|
||
| // Discards any pending change made during this opening of the Dropdown |
There was a problem hiding this comment.
Idem comentario anterior sobre JSDocs
| }) | ||
| } | ||
|
|
||
| // Sends the request to create or update a Tag and selects it as soon as it's saved |
There was a problem hiding this comment.
Idem comentario anterior sobre JSDocs
| } | ||
| ).then((response) => { | ||
| response.json<Biomarker>().then((updatedBiomarker) => { | ||
| console.log('Respuesta del backend:', updatedBiomarker) |
There was a problem hiding this comment.
Borrar todos los console logs que se hayan agregado de testing
| render () { | ||
| const { intl } = this.props | ||
| const { openSelectOptionModal, selectedOption } = this.state | ||
| const tagOptions: DropdownItemProps[] = [ |
There was a problem hiding this comment.
Podemos seguir mejorando:
- Mover esta transformación de Tags a
DropdownItemProps[]dentro del componente. - Adecuar el nombre de la prop para que, en vez de llamarse
tagOptionsse llame simplementetags, y cambiar el tipo para que seaDjangoTag[].
De esta manera seguimos reduciendo código, y encima el día de mañana, si tenemos que cambiar la estructura que devuelve el map, solo cambiaríamos una función en un componente y no múltiples.
No description provided.