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
| * @param tag Tag to delete. | ||
| */ | ||
| const deleteTag = (e: React.MouseEvent<HTMLElement>, tag: DjangoTag) => { | ||
| e.preventDefault() |
There was a problem hiding this comment.
Agregar un mini comentario de por qué estamos haciendo esta línea y la de abajo. Si da lo mismo que estén, borrar, si son importantes explicar por qué
| }) | ||
| } | ||
|
|
||
| // 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
| /** | ||
| * Fetches the User's defined Biomarker/Experiment Tags. | ||
| */ | ||
| getUserTags () { |
There was a problem hiding this comment.
Esto ya lo vi en otro archivo, esta función debería moverse dentro de TagDropdown.tsx, el TagType podría ser una prop del componente. Y el listado de los Tags disponibles debería estar en el estado de TagDropdown (así puede hacerse ahí dentro también el const tagOptions: DropdownItemProps[]....
En caso de que por algún motivo raro no se pueda (preguntame por fa!), extraer esta función a utils.ts o algún archivo de utilitarios. Que reciba por parámetro el TagType y usar esa función en común en todos los lugares donde se necesite.
No description provided.