Skip to content

New tag component - #100

Merged
Genarito merged 7 commits into
devfrom
NewTagComponent
Aug 12, 2026
Merged

New tag component#100
Genarito merged 7 commits into
devfrom
NewTagComponent

Conversation

@GonzzaG

@GonzzaG GonzzaG commented Jul 11, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

})
}

updateBiomarkerTag = async (

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dos correcciones sobre esta función:

  1. Documentala con JSDocs como hacemos con todas las demás.
  2. 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem comentario anterior sobre JSDocs

handleClose()
}

// Discards any pending change made during this opening of the Dropdown

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem comentario anterior sobre JSDocs

Comment thread src/frontend/static/frontend/src/components/common/TagDropdown.tsx
})
}

// Sends the request to create or update a Tag and selects it as soon as it's saved

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem comentario anterior sobre JSDocs

}
).then((response) => {
response.json<Biomarker>().then((updatedBiomarker) => {
console.log('Respuesta del backend:', updatedBiomarker)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Borrar todos los console logs que se hayan agregado de testing

render () {
const { intl } = this.props
const { openSelectOptionModal, selectedOption } = this.state
const tagOptions: DropdownItemProps[] = [

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Podemos seguir mejorando:

  1. Mover esta transformación de Tags a DropdownItemProps[] dentro del componente.
  2. Adecuar el nombre de la prop para que, en vez de llamarse tagOptions se llame simplemente tags, y cambiar el tipo para que sea DjangoTag[].

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.

@Genarito
Genarito merged commit ef47e06 into dev Aug 12, 2026
1 check passed
@Genarito
Genarito deleted the NewTagComponent branch August 12, 2026 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants